mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 13:54:21 +00:00
parent
5bb8c03697
commit
fc213e2d61
2 changed files with 11 additions and 0 deletions
|
|
@ -1164,6 +1164,10 @@ fn fnProtoExpr(
|
||||||
const tree = astgen.tree;
|
const tree = astgen.tree;
|
||||||
const token_tags = tree.tokens.items(.tag);
|
const token_tags = tree.tokens.items(.tag);
|
||||||
|
|
||||||
|
if (fn_proto.name_token) |some| {
|
||||||
|
return astgen.failTok(some, "function type cannot have a name", .{});
|
||||||
|
}
|
||||||
|
|
||||||
const is_extern = blk: {
|
const is_extern = blk: {
|
||||||
const maybe_extern_token = fn_proto.extern_export_inline_token orelse break :blk false;
|
const maybe_extern_token = fn_proto.extern_export_inline_token orelse break :blk false;
|
||||||
break :blk token_tags[maybe_extern_token] == .keyword_extern;
|
break :blk token_tags[maybe_extern_token] == .keyword_extern;
|
||||||
|
|
|
||||||
7
test/cases/compile_errors/function_type_named.zig
Normal file
7
test/cases/compile_errors/function_type_named.zig
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
const aFunc = fn someFunc(x: i32) void;
|
||||||
|
|
||||||
|
// error
|
||||||
|
// backend=stage2
|
||||||
|
// target=native
|
||||||
|
//
|
||||||
|
// :1:18: error: function type cannot have a name
|
||||||
Loading…
Add table
Reference in a new issue