]> granicus.if.org Git - clang/commitdiff
Fix <rdar://problem/6724396>, where we were silently dropping
authorDouglas Gregor <dgregor@apple.com>
Fri, 27 Mar 2009 23:40:29 +0000 (23:40 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 27 Mar 2009 23:40:29 +0000 (23:40 +0000)
GNU-style array designators, causing us to emit broken initializers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67878 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParseInit.cpp
test/CodeGen/designated-initializers.c

index bf31e7bb856d0c92a03633be0d459aa3a805cf3a..3a42e50a9ca9a5cd66b76c51148bfea8f237452b 100644 (file)
@@ -210,7 +210,8 @@ Parser::OwningExprResult Parser::ParseInitializerWithPotentialDesignator() {
       (Desig.getDesignator(0).isArrayDesignator() ||
        Desig.getDesignator(0).isArrayRangeDesignator())) {
     Diag(Tok, diag::ext_gnu_missing_equal_designator);
-    return ParseInitializer();
+    return Actions.ActOnDesignatedInitializer(Desig, SourceLocation(),
+                                              true, ParseInitializer());
   }
 
   Diag(Tok, diag::err_expected_equal_designator);
index 94d446c4e0e463109c356fb136cd872f81ab0099..466933928665c71dd869ce1d1566b12d7a1e4221 100644 (file)
@@ -1,4 +1,5 @@
-// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o - | grep "<{ i8\* null, i32 1024 }>"
+// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o - | grep "<{ i8\* null, i32 1024 }>" &&
+// RUN: clang-cc -triple i386-unknown-unknown %s -emit-llvm -o - | grep "i32 0, i32 22"
 
 struct foo {
     void *a;
@@ -14,3 +15,7 @@ int main(int argc, char **argv)
         .b = 1024,
     };
 }
+
+int b[2] = {
+    [1] 22
+};