const Expr *Init = getInit(0);
if (!Init)
return false;
- Init = Init->IgnoreParens();
+ Init = Init->IgnoreParenImpCasts();
return isa<StringLiteral>(Init) || isa<ObjCEncodeExpr>(Init);
}
// 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;
// We're modifying a string literal init; we have to decompose the string
// so we can modify the individual characters.
ASTContext &Context = SemaRef.Context;
- Expr *SubExpr = StructuredList->getInit(0)->IgnoreParens();
+ Expr *SubExpr = StructuredList->getInit(0)->IgnoreParenImpCasts();
// Compute the character type
QualType CharTy = AT->getElementType();
// CHECK: @pastEnd = constant i32* bitcast (i8* getelementptr (i8, i8* bitcast ([2 x i32]* @arr to i8*), i64 8) to i32*)
int &pastEnd = arr[2];
+// CHECK: @[[WCHAR_STR:.*]] = internal global [2 x i32] [i32 112, i32 0],
+// CHECK: @PR51105_a = global i32* {{.*}} @[[WCHAR_STR]],
+wchar_t *PR51105_a = (wchar_t[2]){ (L"p") };
+// CHECK: @[[CHAR_STR:.*]] = internal global [5 x i8] c"p\00\00\00\00",
+// CHECK: @PR51105_b = global i8* {{.*}} @[[CHAR_STR]],
+char *PR51105_b = (char [5]){ ("p") };
+
struct X {
long n : 8;
};