diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-06 11:41:05 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2013-06-06 11:41:05 +0000 |
commit | 40cba90626044ff28b58c33e743366e94c898227 (patch) | |
tree | 410ff7f7540e5edbe8874a2a536dca456cfabd11 /test | |
parent | 649c6c50fd3dd13577071b26fec4495f7538d923 (diff) | |
download | clang-40cba90626044ff28b58c33e743366e94c898227.tar.gz |
Implement DR1270: braces can be elided in all aggregate initialization, not
just copy-list-initialization in a variable declaration. This effectively
reverts r142147.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@183397 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/SemaCXX/cxx0x-initializer-aggregates.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/test/SemaCXX/cxx0x-initializer-aggregates.cpp b/test/SemaCXX/cxx0x-initializer-aggregates.cpp index f53ac6dff9..0e9a97d5bb 100644 --- a/test/SemaCXX/cxx0x-initializer-aggregates.cpp +++ b/test/SemaCXX/cxx0x-initializer-aggregates.cpp @@ -4,7 +4,6 @@ struct one { char c[1]; }; struct two { char c[2]; }; namespace aggregate { - // Direct list initialization does NOT allow braces to be elided! struct S { int ar[2]; struct T { @@ -20,25 +19,25 @@ namespace aggregate { }; void bracing() { - S s1 = { 1, 2, 3 ,4, 5, 6, 7, 8 }; // no-error - S s2{ {1, 2}, {3, 4}, { {5}, {6} }, { {7, 8} } }; // completely braced - S s3{ 1, 2, 3, 4, 5, 6 }; // expected-error 5 {{cannot omit braces}} - S s4{ {1, 2}, {3, 4}, {5, 6}, { {7, 8} } }; // expected-error 2 {{cannot omit braces}} - S s5{ {1, 2}, {3, 4}, { {5}, {6} }, {7, 8} }; // expected-error {{cannot omit braces}} + S s1 = { 1, 2, 3 ,4, 5, 6, 7, 8 }; + S s2{ {1, 2}, {3, 4}, { {5}, {6} }, { {7, 8} } }; + S s3{ 1, 2, 3, 4, 5, 6 }; + S s4{ {1, 2}, {3, 4}, {5, 6}, { {7, 8} } }; + S s5{ {1, 2}, {3, 4}, { {5}, {6} }, {7, 8} }; } void bracing_new() { - new S{ {1, 2}, {3, 4}, { {5}, {6} }, { {7, 8} } }; // completely braced - new S{ 1, 2, 3, 4, 5, 6 }; // expected-error 5 {{cannot omit braces}} - new S{ {1, 2}, {3, 4}, {5, 6}, { {7, 8} } }; // expected-error 2 {{cannot omit braces}} - new S{ {1, 2}, {3, 4}, { {5}, {6} }, {7, 8} }; // expected-error {{cannot omit braces}} + new S{ {1, 2}, {3, 4}, { {5}, {6} }, { {7, 8} } }; + new S{ 1, 2, 3, 4, 5, 6 }; + new S{ {1, 2}, {3, 4}, {5, 6}, { {7, 8} } }; + new S{ {1, 2}, {3, 4}, { {5}, {6} }, {7, 8} }; } void bracing_construct() { - (void) S{ {1, 2}, {3, 4}, { {5}, {6} }, { {7, 8} } }; // completely braced - (void) S{ 1, 2, 3, 4, 5, 6 }; // expected-error 5 {{cannot omit braces}} - (void) S{ {1, 2}, {3, 4}, {5, 6}, { {7, 8} } }; // expected-error 2 {{cannot omit braces}} - (void) S{ {1, 2}, {3, 4}, { {5}, {6} }, {7, 8} }; // expected-error {{cannot omit braces}} + (void) S{ {1, 2}, {3, 4}, { {5}, {6} }, { {7, 8} } }; + (void) S{ 1, 2, 3, 4, 5, 6 }; + (void) S{ {1, 2}, {3, 4}, {5, 6}, { {7, 8} } }; + (void) S{ {1, 2}, {3, 4}, { {5}, {6} }, {7, 8} }; } struct String { |