diff options
-rw-r--r-- | lib/Sema/SemaInit.cpp | 3 | ||||
-rw-r--r-- | test/CodeGen/init.c | 12 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index bac9f8fa75..7f0f2767c6 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -1474,7 +1474,8 @@ InitListChecker::CheckDesignatedInitializer(const InitializedEntity &Entity, Invalid = true; } - if (!hadError && !isa<InitListExpr>(DIE->getInit())) { + if (!hadError && !isa<InitListExpr>(DIE->getInit()) && + !isa<StringLiteral>(DIE->getInit())) { // The initializer is not an initializer list. SemaRef.Diag(DIE->getInit()->getSourceRange().getBegin(), diag::err_flexible_array_init_needs_braces) diff --git a/test/CodeGen/init.c b/test/CodeGen/init.c index c8de99d901..dc9f82a6c1 100644 --- a/test/CodeGen/init.c +++ b/test/CodeGen/init.c @@ -46,3 +46,15 @@ void f6() { int x; long ids[] = { (long) &x }; } + + + + +// CHECK: @test7 = global{{.*}}{ i32 0, [4 x i8] c"bar\00" } +// PR8217 +struct a7 { + int b; + char v[]; +}; + +struct a7 test7 = { .b = 0, .v = "bar" }; |