diff options
-rw-r--r-- | clang/lib/Sema/SemaDecl.cpp | 2 | ||||
-rw-r--r-- | clang/test/Sema/init.c | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp index e766ca06a5e..0fb939e23ab 100644 --- a/clang/lib/Sema/SemaDecl.cpp +++ b/clang/lib/Sema/SemaDecl.cpp @@ -1031,7 +1031,7 @@ bool Sema::CheckStringLiteralInit(StringLiteral *strLiteral, QualType &DeclT) { StringLiteral *Sema::IsStringLiteralInit(Expr *Init, QualType DeclType) { const ArrayType *AT = Context.getAsArrayType(DeclType); if (AT && AT->getElementType()->isCharType()) { - return dyn_cast<StringLiteral>(Init); + return dyn_cast<StringLiteral>(Init->IgnoreParens()); } return 0; } diff --git a/clang/test/Sema/init.c b/clang/test/Sema/init.c index edaaf64b8be..9f0867869a9 100644 --- a/clang/test/Sema/init.c +++ b/clang/test/Sema/init.c @@ -78,3 +78,5 @@ struct s1 s2 = { .b = bogus // expected-error {{use of undeclared identifier 'bogus'}} } +// PR3382 +char t[] = ("Hello"); |