diff options
Diffstat (limited to 'test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp')
-rw-r--r-- | test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp b/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp index 9d89cce..70f7c64 100644 --- a/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp +++ b/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp @@ -230,3 +230,32 @@ namespace PR18013 { int f(); std::initializer_list<long (*)()> x = {f}; // expected-error {{cannot initialize an array element of type 'long (*const)()' with an lvalue of type 'int ()': different return type ('long' vs 'int')}} } + +namespace DR1070 { + struct S { + S(std::initializer_list<int>); + }; + S s[3] = { {1, 2, 3}, {4, 5} }; // ok + S *p = new S[3] { {1, 2, 3}, {4, 5} }; // ok +} + +namespace ListInitInstantiate { + struct A { + A(std::initializer_list<A>); + A(std::initializer_list<int>); + }; + struct B : A { + B(int); + }; + template<typename T> struct X { + X(); + A a; + }; + template<typename T> X<T>::X() : a{B{0}, B{1}} {} + + X<int> x; + + int f(const A&); + template<typename T> void g() { int k = f({0}); } + template void g<int>(); +} |