diff options
author | Richard Smith <richard@metafoo.co.uk> | 2021-08-25 11:01:45 -0700 |
---|---|---|
committer | Richard Smith <richard@metafoo.co.uk> | 2021-08-25 11:36:11 -0700 |
commit | ea1c01dde03b45e0b33d3883147d3b4fb489978c (patch) | |
tree | 4e7ce8ed3e2d83a3b08df26e1d35f290cdd786fd /clang/lib/AST/ExprConstant.cpp | |
parent | d5f7f356cea3790df7183bd6e994b1e140163177 (diff) | |
download | llvm-ea1c01dde03b45e0b33d3883147d3b4fb489978c.zip llvm-ea1c01dde03b45e0b33d3883147d3b4fb489978c.tar.gz llvm-ea1c01dde03b45e0b33d3883147d3b4fb489978c.tar.bz2 |
PR51105: look through ConstantExpr when looking for a braced string literal initialization.
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp index f49a144..a3879db 100644 --- a/clang/lib/AST/ExprConstant.cpp +++ b/clang/lib/AST/ExprConstant.cpp @@ -10473,13 +10473,17 @@ bool ArrayExprEvaluator::VisitInitListExpr(const InitListExpr *E, // C++11 [dcl.init.string]p1: A char array [...] can be initialized by [...] // an appropriately-typed string literal enclosed in braces. if (E->isStringLiteralInit()) { - auto *SL = dyn_cast<StringLiteral>(E->getInit(0)->IgnoreParens()); + auto *SL = dyn_cast<StringLiteral>(E->getInit(0)->IgnoreParenImpCasts()); // FIXME: Support ObjCEncodeExpr here once we support it in // ArrayExprEvaluator generally. if (!SL) return Error(E); return VisitStringLiteral(SL, AllocType); } + // Any other transparent list init will need proper handling of the + // AllocType; we can't just recurse to the inner initializer. + assert(!E->isTransparent() && + "transparent array list initialization is not string literal init?"); bool Success = true; |