aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2020-02-18 22:53:03 +0100
committerAndrew Kelley <andrew@ziglang.org>2020-02-18 18:18:29 -0500
commita6b74cdd38a2aac25275c97c00133ec7134aacd2 (patch)
tree2eaf781005ce814d8d243326d41b6134982e83ac /src/parser.cpp
parent95a71e29f84573ce72b16406eaf1a6dff96de35f (diff)
downloadzig-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.cpp3
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;