diff options
author | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-04-08 18:45:10 +0000 |
commit | c72c57c9e9b69944e3e009cd5e209634839581d3 (patch) | |
tree | 4fc2f184c499d106f29a386c452b49e5197bf63d /test/SemaCXX/cxx0x-initializer-constructor.cpp | |
parent | 5b20025c30d23d521e12c1f33ec8fa6b821952cd (diff) | |
download | FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.zip FreeBSD-src-c72c57c9e9b69944e3e009cd5e209634839581d3.tar.gz |
Vendor import of clang trunk r178860:
http://llvm.org/svn/llvm-project/cfe/trunk@178860
Diffstat (limited to 'test/SemaCXX/cxx0x-initializer-constructor.cpp')
-rw-r--r-- | test/SemaCXX/cxx0x-initializer-constructor.cpp | 59 |
1 files changed, 52 insertions, 7 deletions
diff --git a/test/SemaCXX/cxx0x-initializer-constructor.cpp b/test/SemaCXX/cxx0x-initializer-constructor.cpp index a657ec8..dc179f8 100644 --- a/test/SemaCXX/cxx0x-initializer-constructor.cpp +++ b/test/SemaCXX/cxx0x-initializer-constructor.cpp @@ -75,9 +75,8 @@ namespace objects { { F<0> f = {}; } // Narrowing conversions don't affect viability. The next two choose // the initializer_list constructor. - // FIXME: Emit narrowing conversion errors. - { F<3> f{1, 1.0}; } // xpected-error {{narrowing conversion}} - { F<3> f = {1, 1.0}; } // xpected-error {{narrowing conversion}} + { F<3> f{1, 1.0}; } // expected-error {{type 'double' cannot be narrowed to 'int' in initializer list}} expected-note {{override}} + { F<3> f = {1, 1.0}; } // expected-error {{type 'double' cannot be narrowed to 'int' in initializer list}} expected-note {{override}} { F<3> f{1, 2, 3, 4, 5, 6, 7, 8}; } { F<3> f = {1, 2, 3, 4, 5, 6, 7, 8}; } { F<3> f{1, 2, 3, 4, 5, 6, 7, 8}; } @@ -306,17 +305,63 @@ namespace init_list_default { } -// <rdar://problem/11974632> -namespace rdar11974632 { +// PR13470, <rdar://problem/11974632> +namespace PR13470 { + struct W { + explicit W(int); // expected-note {{here}} + }; + struct X { - X(const X&) = delete; + X(const X&) = delete; // expected-note 3 {{here}} X(int); }; + template<typename T, typename Fn> void call(Fn f) { + f({1}); // expected-error {{constructor is explicit}} + f(T{1}); // expected-error {{call to deleted constructor}} + } + + void ref_w(const W &); // expected-note 2 {{not viable}} + void call_ref_w() { + ref_w({1}); // expected-error {{no matching function}} + ref_w(W{1}); + call<W>(ref_w); // expected-note {{instantiation of}} + } + + void ref_x(const X &); + void call_ref_x() { + ref_x({1}); + ref_x(X{1}); + call<X>(ref_x); // ok + } + + void val_x(X); // expected-note 2 {{parameter}} + void call_val_x() { + val_x({1}); + val_x(X{1}); // expected-error {{call to deleted constructor}} + call<X>(val_x); // expected-note {{instantiation of}} + } + template<typename T> - struct Y { + struct Y { X x{1}; + void f() { X x{1}; } + void h() { + ref_w({1}); // expected-error {{no matching function}} + ref_w(W{1}); + ref_x({1}); + ref_x(X{1}); + val_x({1}); + val_x(X{1}); // expected-error {{call to deleted constructor}} + } + Y() {} + Y(int) : x{1} {} }; Y<int> yi; + Y<int> yi2(0); + void g() { + yi.f(); + yi.h(); // ok, all diagnostics produced in template definition + } } |