summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp')
-rw-r--r--test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp b/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
index 88571d6..9d89cce 100644
--- a/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
+++ b/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp
@@ -144,7 +144,7 @@ namespace PR12119 {
template<typename T> void g(std::initializer_list<std::initializer_list<T>>);
void foo() {
- f({0, {1}});
+ f({0, {1}}); // expected-warning{{braces around scalar initializer}}
g({{0, 1}, {2, 3}});
std::initializer_list<int> il = {1, 2};
g({il, {2, 3}});
@@ -208,3 +208,25 @@ namespace init_list_deduction_failure {
void h() { g({f}); }
// expected-error@-1 {{no matching function for call to 'g'}}
}
+
+namespace deleted_copy {
+ struct X {
+ X(int i) {}
+ X(const X& x) = delete; // expected-note {{here}}
+ void operator=(const X& x) = delete;
+ };
+
+ std::initializer_list<X> x{1}; // expected-error {{invokes deleted constructor}}
+}
+
+namespace RefVersusInitList {
+ struct S {};
+ void f(const S &) = delete;
+ void f(std::initializer_list<S>);
+ void g(S s) { f({S()}); }
+}
+
+namespace PR18013 {
+ int f();
+ std::initializer_list<long (*)()> x = {f}; // expected-error {{cannot initialize an array element of type 'long (*const)()' with an lvalue of type 'int ()': different return type ('long' vs 'int')}}
+}
OpenPOWER on IntegriCloud