diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
commit | 461a67fa15370a9ec88f8f8a240bf7c123bb2029 (patch) | |
tree | 6942083d7d56bba40ec790a453ca58ad3baf6832 /test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp | |
parent | 75c3240472ba6ac2669ee72ca67eb72d4e2851fc (diff) |
Diffstat (limited to 'test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp')
-rw-r--r-- | test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp b/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp index 9b8fadd2f5226..860a4aa6c6ff1 100644 --- a/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp +++ b/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp @@ -136,13 +136,19 @@ void auto_deduction() { auto l3 {1}; static_assert(same_type<decltype(l), std::initializer_list<int>>::value, ""); static_assert(same_type<decltype(l3), int>::value, ""); - auto bl = {1, 2.0}; // expected-error {{cannot deduce}} + auto bl = {1, 2.0}; // expected-error {{deduced conflicting types ('int' vs 'double') for initializer list element type}} + + void f1(int), f1(float), f2(int), f3(float); + auto fil = {f1, f2}; + auto ffl = {f1, f3}; + auto fl = {f1, f2, f3}; // expected-error {{deduced conflicting types ('void (*)(int)' vs 'void (*)(float)') for initializer list element type}} for (int i : {1, 2, 3, 4}) {} + for (int j : {1.0, 2.0, 3.0f, 4.0}) {} // expected-error {{deduced conflicting types ('double' vs 'float') for initializer list element type}} } void dangle() { - new auto{1, 2, 3}; // expected-error {{cannot use list-initialization}} + new auto{1, 2, 3}; // expected-error {{new expression for type 'auto' contains multiple constructor arguments}} new std::initializer_list<int>{1, 2, 3}; // expected-warning {{at the end of the full-expression}} } |