diff options
-rw-r--r-- | lib/Sema/SemaInit.cpp | 2 | ||||
-rw-r--r-- | test/Sema/designated-initializers.c | 21 |
2 files changed, 22 insertions, 1 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp index 496dbcdefa..27d8d5aa2e 100644 --- a/lib/Sema/SemaInit.cpp +++ b/lib/Sema/SemaInit.cpp @@ -1197,7 +1197,7 @@ InitListChecker::CheckDesignatedInitializer(InitListExpr *IList, // Check the remaining elements within this array subobject. bool prevHadError = hadError; - CheckArrayType(IList, CurrentObjectType, DesignatedStartIndex, true, Index, + CheckArrayType(IList, CurrentObjectType, DesignatedStartIndex, false, Index, StructuredList, ElementIndex); return hadError && !prevHadError; } diff --git a/test/Sema/designated-initializers.c b/test/Sema/designated-initializers.c index 53da306c4c..9c4429d02d 100644 --- a/test/Sema/designated-initializers.c +++ b/test/Sema/designated-initializers.c @@ -151,3 +151,24 @@ struct XY { int before; struct XX xx, *xp; float* after; } xy[] = { 0, // expected-warning{{initializer overrides prior initialization of this subobject}} &xy[2].xx.a, &xy[2].xx, &global_float }; + +// PR3519 +struct foo { + int arr[10]; +}; + +struct foo Y[10] = { + [1] .arr [1] = 2, + [4] .arr [2] = 4 +}; + +struct bar { + struct foo f; + float *arr[10]; +}; + +extern float f; +struct bar saloon = { + .f.arr[3] = 1, + .arr = { &f } +}; |