diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp | 7 | ||||
-rw-r--r-- | clang/test/SemaCXX/cxx0x-initializer-constructor.cpp | 21 |
2 files changed, 23 insertions, 5 deletions
diff --git a/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp b/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp index e4551d98914..4ee3cd3f6bf 100644 --- a/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp +++ b/clang/test/SemaCXX/cxx0x-initializer-aggregates.cpp @@ -34,6 +34,13 @@ namespace aggregate { new S{ {1, 2}, {3, 4}, { {5}, {6} }, {7, 8} }; // expected-error {{cannot omit braces}} } + 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}} + } + struct String { String(const char*); }; diff --git a/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp b/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp index 3e74ad777f9..f7e89d3227a 100644 --- a/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp +++ b/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp @@ -147,32 +147,43 @@ namespace objects { static_assert(sizeof(ov2({1, 2, 3})) == sizeof(two), "bad overload"); // list -> F only viable } - struct G { // expected-note 2 {{not viable}} + struct G { // expected-note 6 {{not viable}} // This is not an initializer-list constructor. template<typename ...T> - G(std::initializer_list<int>, T ...); // expected-note {{not viable}} + G(std::initializer_list<int>, T ...); // expected-note 3 {{not viable}} }; - struct H { // expected-note 2 {{not viable}} - explicit H(int, int); // expected-note {{not viable}} - H(int, void*); // expected-note {{not viable}} + struct H { // expected-note 6 {{not viable}} + explicit H(int, int); // expected-note 3 {{not viable}} + H(int, void*); // expected-note 3 {{not viable}} }; void edge_cases() { // invalid (the first phase only considers init-list ctors) // (for the second phase, no constructor is viable) G g1{1, 2, 3}; // expected-error {{no matching constructor}} + (void) new G{1, 2, 3}; // expected-error {{no matching constructor}} + (void) G{1, 2, 3} // expected-error {{no matching constructor}} // valid (T deduced to <>). G g2({1, 2, 3}); + (void) new G({1, 2, 3}); + (void) G({1, 2, 3}); // invalid H h1({1, 2}); // expected-error {{no matching constructor}} + (void) new H({1, 2}); // expected-error {{no matching constructor}} + // FIXME: Bad diagnostic, mentions void type instead of init list. + (void) H({1, 2}); // expected-error {{no matching conversion}} // valid (by copy constructor). H h2({1, nullptr}); + (void) new H({1, nullptr}); + (void) H({1, nullptr}); // valid H h3{1, 2}; + (void) new H{1, 2}; + (void) H{1, 2}; } } |