[OPENMP] Restore allowing of braced initializers in the declare reduction

init.

Braced initializers were not accepted after the last fix in the initialier.Restored previous functionality.
This commit is contained in:
Alexey Bataev 2020-01-02 15:49:08 -05:00
parent 3ddfb04f41
commit 1fcc9b6ff8
2 changed files with 3 additions and 1 deletions

View File

@ -430,7 +430,7 @@ void Parser::ParseOpenMPReductionInitializerForDecl(VarDecl *OmpPrivParm) {
}
PreferredType.enterVariableInit(Tok.getLocation(), OmpPrivParm);
ExprResult Init = ParseAssignmentExpression();
ExprResult Init = ParseInitializer();
if (Init.isInvalid()) {
SkipUntil(tok::r_paren, tok::annot_pragma_openmp_end, StopBeforeMatch);

View File

@ -45,6 +45,8 @@ struct S {
int s;
};
#pragma omp declare reduction(+: struct S: omp_out.s += omp_in.s) // initializer(omp_priv = { .s = 0 })
#pragma omp declare reduction(&: struct S: omp_out.s += omp_in.s) initializer(omp_priv = { .s = 0 })
#pragma omp declare reduction(|: struct S: omp_out.s += omp_in.s) initializer(omp_priv = { 0 })
int fun(int arg) {
struct S s;// expected-note {{'s' defined here}}