| author | |
| committer | |
| log | 5b156031e92c66c1bea71d5eb6c337b23185d65d |
| tree | 5c8bfbed8f6b555ea15ac11226bc97bf1669fcfa |
| parent | 5c988cc7222db9b1a943ba0dd40f7f6116813bcb |
2 files changed, 11 insertions(+), 1 deletions(-)
src/parser.cpp+1-1| ... | ... | @@ -2552,7 +2552,7 @@ static AstNode *ast_parse_container_decl(ParseContext *pc, size_t *token_index, |
| 2552 | 2552 | Token *eq_token = &pc->tokens->at(*token_index); |
| 2553 | 2553 | if (eq_token->id == TokenIdEq) { |
| 2554 | 2554 | *token_index += 1; |
| 2555 | field_node->data.struct_field.value = ast_parse_prefix_op_expr(pc, token_index, true); | |
| 2555 | field_node->data.struct_field.value = ast_parse_expression(pc, token_index, true); | |
| 2556 | 2556 | } |
| 2557 | 2557 | |
| 2558 | 2558 | Token *next_token = &pc->tokens->at(*token_index); |
test/cases/enum.zig+10| ... | ... | @@ -377,3 +377,13 @@ test "switch on enum with one member is comptime known" { |
| 377 | 377 | } |
| 378 | 378 | @compileError("analysis should not reach here"); |
| 379 | 379 | } |
| 380 | ||
| 381 | const EnumWithTagValues = enum(u4) { | |
| 382 | A = 1 << 0, | |
| 383 | B = 1 << 1, | |
| 384 | C = 1 << 2, | |
| 385 | D = 1 << 3, | |
| 386 | }; | |
| 387 | test "enum with tag values don't require parens" { | |
| 388 | assert(u4(EnumWithTagValues.C) == 0b0100); | |
| 389 | } |