diff options
| author | LemonBoy <thatlemon@gmail.com> | 2020-02-18 22:53:03 +0100 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-02-18 18:18:29 -0500 |
| commit | a6b74cdd38a2aac25275c97c00133ec7134aacd2 (patch) | |
| tree | 2eaf781005ce814d8d243326d41b6134982e83ac /src/parser.cpp | |
| parent | 95a71e29f84573ce72b16406eaf1a6dff96de35f (diff) | |
| download | zig-a6b74cdd38a2aac25275c97c00133ec7134aacd2.tar.gz zig-a6b74cdd38a2aac25275c97c00133ec7134aacd2.zip | |
stage1: Make the parser reject extern fn with body
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index c8c53e81b7..275fa90167 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -689,6 +689,9 @@ static AstNode *ast_parse_top_level_decl(ParseContext *pc, VisibMod visib_mod, B AstNode *res = fn_proto; if (body != nullptr) { + if (fn_proto->data.fn_proto.is_extern) { + ast_error(pc, first, "Extern functions have no body"); + } res = ast_create_node_copy_line_info(pc, NodeTypeFnDef, fn_proto); res->data.fn_def.fn_proto = fn_proto; res->data.fn_def.body = body; |
