parent
09cc1dc660
commit
901b5c1566
@ -3242,6 +3242,13 @@ static void add_top_level_decl(CodeGen *g, ScopeDecls *decls_scope, Tld *tld) {
|
|||||||
} else if (tld->id == TldIdFn) {
|
} else if (tld->id == TldIdFn) {
|
||||||
assert(tld->source_node->type == NodeTypeFnProto);
|
assert(tld->source_node->type == NodeTypeFnProto);
|
||||||
is_export = tld->source_node->data.fn_proto.is_export;
|
is_export = tld->source_node->data.fn_proto.is_export;
|
||||||
|
|
||||||
|
if (!is_export && !tld->source_node->data.fn_proto.is_extern &&
|
||||||
|
tld->source_node->data.fn_proto.fn_def_node == nullptr)
|
||||||
|
{
|
||||||
|
add_node_error(g, tld->source_node, buf_sprintf("non-extern function has no body"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (is_export) {
|
if (is_export) {
|
||||||
g->resolve_queue.append(tld);
|
g->resolve_queue.append(tld);
|
||||||
|
@ -1,6 +1,16 @@
|
|||||||
const tests = @import("tests.zig");
|
const tests = @import("tests.zig");
|
||||||
|
|
||||||
pub fn addCases(cases: *tests.CompileErrorContext) void {
|
pub fn addCases(cases: *tests.CompileErrorContext) void {
|
||||||
|
cases.add(
|
||||||
|
"function protoype with no body",
|
||||||
|
\\fn foo() void;
|
||||||
|
\\export fn entry() void {
|
||||||
|
\\ foo();
|
||||||
|
\\}
|
||||||
|
,
|
||||||
|
".tmp_source.zig:1:1: error: non-extern function has no body",
|
||||||
|
);
|
||||||
|
|
||||||
cases.add(
|
cases.add(
|
||||||
"@typeInfo causing depend on itself compile error",
|
"@typeInfo causing depend on itself compile error",
|
||||||
\\const start = struct {
|
\\const start = struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user