diff options
| author | Kevin Watters <kevinwatters@gmail.com> | 2019-03-31 12:03:22 -0400 |
|---|---|---|
| committer | Kevin Watters <kevinwatters@gmail.com> | 2019-03-31 12:03:22 -0400 |
| commit | 381fbd3dafed820583c97f176d2694b21358d178 (patch) | |
| tree | 071c9b572b655ca2ca5597a7252eebe228670a02 /src/parser.cpp | |
| parent | 76a2807b56a9c0a40c66915d5b77cf537ad376f2 (diff) | |
| parent | dd9113786c4e7b18e894bd3ceee94cdf08ac6037 (diff) | |
Merge branch 'master' of github.com:odin-lang/Odin
Diffstat (limited to 'src/parser.cpp')
| -rw-r--r-- | src/parser.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/parser.cpp b/src/parser.cpp index 2eee82e22..12b7edb01 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -3024,6 +3024,7 @@ Ast *parse_field_list(AstFile *f, isize *name_count_, u32 allowed_flags, TokenKi isize total_name_count = 0; bool allow_ellipsis = allowed_flags&FieldFlag_ellipsis; bool seen_ellipsis = false; + bool is_signature = (allowed_flags & FieldFlag_Signature) == FieldFlag_Signature; while (f->curr_token.kind != follow && f->curr_token.kind != Token_Colon && @@ -3064,7 +3065,7 @@ Ast *parse_field_list(AstFile *f, isize *name_count_, u32 allowed_flags, TokenKi if (f->curr_token.kind != Token_Eq) { type = parse_var_type(f, allow_ellipsis, allow_typeid_token); Ast *tt = unparen_expr(type); - if (!any_polymorphic_names && tt->kind == Ast_TypeidType && tt->TypeidType.specialization != nullptr) { + if (is_signature && !any_polymorphic_names && tt->kind == Ast_TypeidType && tt->TypeidType.specialization != nullptr) { syntax_error(type, "Specialization of typeid is not allowed without polymorphic names"); } } @@ -3121,7 +3122,7 @@ Ast *parse_field_list(AstFile *f, isize *name_count_, u32 allowed_flags, TokenKi if (f->curr_token.kind != Token_Eq) { type = parse_var_type(f, allow_ellipsis, allow_typeid_token); Ast *tt = unparen_expr(type); - if (!any_polymorphic_names && tt->kind == Ast_TypeidType && tt->TypeidType.specialization != nullptr) { + if (is_signature && !any_polymorphic_names && tt->kind == Ast_TypeidType && tt->TypeidType.specialization != nullptr) { syntax_error(type, "Specialization of typeid is not allowed without polymorphic names"); } } |