Skip to content

Commit 7a432e7

Browse files
committed
C++ front-end: fix parentheses matching for alignas parsing
We had parentheses consumed by rCommaExpression while still expecting to find one after this rule executed.
1 parent 0889cfa commit 7a432e7

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

regression/cpp/alignas1/main.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
struct alignas(0x1) t
2+
{
3+
char c;
4+
};
5+
6+
int main(int argc, char *argv[])
7+
{
8+
struct t t;
9+
}

regression/cpp/alignas1/test.desc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.cpp
3+
-std=c++11
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$

src/cpp/parse.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2122,9 +2122,8 @@ bool Parser::optAlignas(typet &cv)
21222122

21232123
typet tname;
21242124
cpp_tokent op, cp;
2125-
2126-
cpp_token_buffert::post pos=lex.Save();
21272125
lex.get_token(op);
2126+
cpp_token_buffert::post pos = lex.Save();
21282127

21292128
if(rTypeName(tname))
21302129
{

0 commit comments

Comments
 (0)