diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-03-20 00:32:56 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-03-20 00:32:56 +0000 |
commit | 07d8e3a500477fef5164f928b6b9cec45580ccef (patch) | |
tree | 463b180b52cde4acb0b44fcbb984b6678eab0ce1 /clang/test/Sema/flexible-array-init.c | |
parent | a1a0e4b27e80e11cb87fc5e41492c946ba5b068e (diff) | |
download | bcm5719-llvm-07d8e3a500477fef5164f928b6b9cec45580ccef.tar.gz bcm5719-llvm-07d8e3a500477fef5164f928b6b9cec45580ccef.zip |
Allow flexible array initializers that are not surrounded by
braces. We now build the appropriate fully-structured initializer list
for such things. Per PR3618, verified that we're getting the right
code generation.
llvm-svn: 67353
Diffstat (limited to 'clang/test/Sema/flexible-array-init.c')
-rw-r--r-- | clang/test/Sema/flexible-array-init.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/test/Sema/flexible-array-init.c b/clang/test/Sema/flexible-array-init.c index fff5fee2afc..2b8f40fa5b0 100644 --- a/clang/test/Sema/flexible-array-init.c +++ b/clang/test/Sema/flexible-array-init.c @@ -1,24 +1,24 @@ // RUN: clang -fsyntax-only -pedantic -verify %s struct one { int a; - int values[]; -} x = {5, {1, 2, 3}}; + int values[]; // expected-note 3{{initialized flexible array member 'values' is here}} +} x = {5, {1, 2, 3}}; // expected-warning{{flexible array initialization is a GNU extension}} -struct one x2 = { 5, 1, 2, 3 }; // expected-warning{{excess elements in struct initializer}} +struct one x2 = { 5, 1, 2, 3 }; // expected-warning{{flexible array initialization is a GNU extension}} void test() { - struct one x3 = {5, {1, 2, 3}}; + struct one x3 = {5, {1, 2, 3}}; // expected-warning{{flexible array initialization is a GNU extension}} } struct foo { int x; - int y[]; // expected-note 4 {{initialized flexible array member 'y' is here}} + int y[]; // expected-note 6 {{initialized flexible array member 'y' is here}} }; struct bar { struct foo z; }; // expected-warning {{'z' may not be nested in a struct due to flexible array member}} -struct foo a = { 1, { 2, 3, 4 } }; // Valid. +struct foo a = { 1, { 2, 3, 4 } }; // expected-warning{{flexible array initialization is a GNU extension}} struct bar b = { { 1, { 2, 3, 4 } } }; // expected-error{{non-empty initialization of flexible array member inside subobject}} -struct bar c = { { 1, { } } }; // Valid. \ +struct bar c = { { 1, { } } }; // // expected-warning{{flexible array initialization is a GNU extension}} \ // expected-warning{{use of GNU empty initializer extension}} \ // expected-warning{{zero size arrays are an extension}} struct foo d[1] = { { 1, { 2, 3, 4 } } }; // expected-warning{{'struct foo' may not be used as an array element due to flexible array member}} \ |