Skip to content

Commit a3eb3a3

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 1ca5700 commit a3eb3a3

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
@@ -2151,9 +2151,8 @@ bool Parser::optAlignas(typet &cv)
21512151

21522152
typet tname;
21532153
cpp_tokent op, cp;
2154-
2155-
cpp_token_buffert::post pos=lex.Save();
21562154
lex.get_token(op);
2155+
cpp_token_buffert::post pos = lex.Save();
21572156

21582157
if(rTypeName(tname))
21592158
{

0 commit comments

Comments
 (0)