Skip to content

Commit 4d9b56a

Browse files
committed
Parser: Shapes in OSSShapingExpr must be parsed with ParseExpression (i.e. we allow top level comma)
1 parent f95d4a6 commit 4d9b56a

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

clang/lib/Parse/ParseExpr.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -3273,7 +3273,7 @@ ExprResult Parser::TryParseOSSArrayShaping() {
32733273

32743274
// Parse whatever between []
32753275
Diags.setSuppressAllDiagnostics();
3276-
Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression());
3276+
Actions.CorrectDelayedTyposInExpr(ParseExpression());
32773277
Diags.setSuppressAllDiagnostics(false);
32783278

32793279
// After that we're supposed to be at ]
@@ -3323,7 +3323,7 @@ ExprResult Parser::ParseOSSArrayShaping() {
33233323
Loc = T.getOpenLocation();
33243324
First = false;
33253325

3326-
ExprResult ShapeExpr = Actions.CorrectDelayedTyposInExpr(ParseAssignmentExpression());
3326+
ExprResult ShapeExpr = Actions.CorrectDelayedTyposInExpr(ParseExpression());
33273327

33283328
ShapeList.push_back(ShapeExpr.get());
33293329

clang/test/OmpSs/Parser/shaping_expr_vs_lambda.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@ void foo2(int x) {
2121
{}
2222
#pragma oss task depend(in : [x + x]() {} ) // expected-error {{expected ',' or ']' in lambda capture list}}
2323
{}
24-
// Incomplete lambdas ignore whatever is after it until ';'
25-
#pragma oss task depend(in : [x,](array), [x,](array){} ) // expected-error {{expected variable name or 'this' in lambda capture list}}
24+
#pragma oss task depend(in : [x,](array), [x,](array){}, [3](array, array)) // expected-error 2 {{expected expression}} expected-warning {{expression result unused}}
2625
{}
2726
#pragma oss task depend(in : [x](int a) {} ) // expected-error {{expected addressable lvalue expression, array element or array section}}
2827
{}

0 commit comments

Comments
 (0)