summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-07-05 08:39:21 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-07-05 08:39:21 +0000
commitd86812d95c3a592f40e5249dfef324b456ea26d7 (patch)
tree08c65181fea1a97eaee55fe64b20979d55e80893 /clang/test/SemaCXX/cxx0x-initializer-constructor.cpp
parent1ea42eb5a33bb48c5ce085e27c2701a6e8563645 (diff)
downloadbcm5719-llvm-d86812d95c3a592f40e5249dfef324b456ea26d7.tar.gz
bcm5719-llvm-d86812d95c3a592f40e5249dfef324b456ea26d7.zip
PR13273: When performing list-initialization with an empty initializer list,
actually perform value initialization rather than trying to fake it with a call to the default constructor. Fixes various bugs related to the previously-missing zero-initialization in this case. I've also moved this and the other list initialization 'special case' from TryConstructorInitialization into TryListInitialization where they belong. llvm-svn: 159733
Diffstat (limited to 'clang/test/SemaCXX/cxx0x-initializer-constructor.cpp')
-rw-r--r--clang/test/SemaCXX/cxx0x-initializer-constructor.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp b/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp
index 09aca24b704..223e140ffc0 100644
--- a/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp
+++ b/clang/test/SemaCXX/cxx0x-initializer-constructor.cpp
@@ -279,5 +279,28 @@ namespace PR12498 {
{
c->foo({ nullptr, 1 }); // expected-error{{initialization of incomplete type 'const PR12498::ArrayRef'}}
}
+}
+
+namespace explicit_default {
+ struct A {
+ explicit A(); // expected-note{{here}}
+ };
+ A a {}; // ok
+ // This is copy-list-initialization, and we choose an explicit constructor
+ // (even though we do so via value-initialization), so the initialization is
+ // ill-formed.
+ A b = {}; // expected-error{{chosen constructor is explicit}}
+}
+namespace init_list_default {
+ struct A {
+ A(std::initializer_list<int>);
+ };
+ A a {}; // calls initializer list constructor
+
+ struct B {
+ B();
+ B(std::initializer_list<int>) = delete;
+ };
+ B b {}; // calls default constructor
}
OpenPOWER on IntegriCloud