aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/cxx0x-initializer-constructor.cpp
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2012-02-13 19:55:43 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2012-02-13 19:55:43 +0000
commit20ff0e2d74c188cb3fd4ec3dead41a80a37c0202 (patch)
tree0b4f048f4df823535d2322279fa90017a0788f36 /test/SemaCXX/cxx0x-initializer-constructor.cpp
parent43a1b00153a60e3bab1ff66e4674b1bc13d23817 (diff)
Don't route explicit construction via list-initialization through the functional cast code path. It sometimes does the wrong thing, produces horrible error messages, and is just unnecessary.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150408 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/SemaCXX/cxx0x-initializer-constructor.cpp')
-rw-r--r--test/SemaCXX/cxx0x-initializer-constructor.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/test/SemaCXX/cxx0x-initializer-constructor.cpp b/test/SemaCXX/cxx0x-initializer-constructor.cpp
index 3e74ad777f..f7e89d3227 100644
--- a/test/SemaCXX/cxx0x-initializer-constructor.cpp
+++ b/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};
}
}