diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-19 01:39:02 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2012-12-19 01:39:02 +0000 |
commit | c83c2300e1946fea78ecd3c2e93d9c2dd2638a2b (patch) | |
tree | 5f7c649d837df75ff3bcfaf0b76501c610f55ce1 /test/SemaCXX/cxx0x-initializer-constructor.cpp | |
parent | 9fcc2ab2ec5e00802880e205568ff3afbd70a773 (diff) |
PR13470: Ensure that copy-list-initialization isntantiates as
copy-list-initialization (and doesn't add an additional copy step):
Fill in the ListInitialization bit when creating a CXXConstructExpr. Use it
when instantiating initializers in order to correctly handle instantiation of
copy-list-initialization. Teach TreeTransform that function arguments are
initializations, and so need this special treatment too. Finally, remove some
hacks which were working around SubstInitializer's shortcomings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@170489 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/cxx0x-initializer-constructor.cpp')
-rw-r--r-- | test/SemaCXX/cxx0x-initializer-constructor.cpp | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/test/SemaCXX/cxx0x-initializer-constructor.cpp b/test/SemaCXX/cxx0x-initializer-constructor.cpp index a657ec81a1..45ec0cbfdd 100644 --- a/test/SemaCXX/cxx0x-initializer-constructor.cpp +++ b/test/SemaCXX/cxx0x-initializer-constructor.cpp @@ -306,17 +306,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 + } } |