From bfe9d4184fb9b4d0cfd0964f18bb3789f3023939 Mon Sep 17 00:00:00 2001 From: Vexu Date: Sat, 11 Jul 2020 20:35:00 +0300 Subject: [PATCH] fix alignment parsing in stage1 --- src/parser.cpp | 2 +- test/stage1/behavior/eval.zig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser.cpp b/src/parser.cpp index fcd1133b0d..26233ec6a4 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -2679,7 +2679,7 @@ static AstNode *ast_parse_prefix_type_op(ParseContext *pc) { if (eat_token_if(pc, TokenIdKeywordAlign) != nullptr) { expect_token(pc, TokenIdLParen); - AstNode *align_expr = ast_parse_expr(pc); + AstNode *align_expr = ast_expect(pc, ast_parse_expr); child->data.pointer_type.align_expr = align_expr; if (eat_token_if(pc, TokenIdColon) != nullptr) { Token *bit_offset_start = expect_token(pc, TokenIdIntLiteral); diff --git a/test/stage1/behavior/eval.zig b/test/stage1/behavior/eval.zig index 17d5aafe06..38dd12c59d 100644 --- a/test/stage1/behavior/eval.zig +++ b/test/stage1/behavior/eval.zig @@ -758,7 +758,7 @@ test "comptime bitwise operators" { test "*align(1) u16 is the same as *align(1:0:2) u16" { comptime { expect(*align(1:0:2) u16 == *align(1) u16); - expect(*align(:0:2) u16 == *u16); + expect(*align(2:0:2) u16 == *u16); } }