diff options
Diffstat (limited to 'test/SemaCXX/cxx0x-cursory-default-delete.cpp')
-rw-r--r-- | test/SemaCXX/cxx0x-cursory-default-delete.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/test/SemaCXX/cxx0x-cursory-default-delete.cpp b/test/SemaCXX/cxx0x-cursory-default-delete.cpp index 3290595..641760e 100644 --- a/test/SemaCXX/cxx0x-cursory-default-delete.cpp +++ b/test/SemaCXX/cxx0x-cursory-default-delete.cpp @@ -7,11 +7,14 @@ struct non_copiable { }; struct non_const_copy { - non_const_copy(non_const_copy&) = default; // expected-note {{not viable}} - non_const_copy& operator = (non_const_copy&) & = default; // expected-note {{not viable}} - non_const_copy& operator = (non_const_copy&) && = default; // expected-note {{not viable}} + non_const_copy(non_const_copy&); + non_const_copy& operator = (non_const_copy&) &; + non_const_copy& operator = (non_const_copy&) &&; non_const_copy() = default; // expected-note {{not viable}} }; +non_const_copy::non_const_copy(non_const_copy&) = default; // expected-note {{not viable}} +non_const_copy& non_const_copy::operator = (non_const_copy&) & = default; // expected-note {{not viable}} +non_const_copy& non_const_copy::operator = (non_const_copy&) && = default; // expected-note {{not viable}} void fn1 () { non_copiable nc; @@ -21,7 +24,8 @@ void fn1 () { non_const_copy ncc; non_const_copy ncc2 = ncc; ncc = ncc2; - const non_const_copy cncc; + const non_const_copy cncc{}; + const non_const_copy cncc1; // expected-error {{default initialization of an object of const type 'const non_const_copy' requires a user-provided default constructor}} non_const_copy ncc3 = cncc; // expected-error {{no matching}} ncc = cncc; // expected-error {{no viable overloaded}} }; @@ -32,9 +36,9 @@ struct non_const_derived : non_const_copy { }; struct bad_decls { - bad_decls(volatile bad_decls&) = default; // expected-error {{may not be volatile}} - bad_decls&& operator = (bad_decls) = default; // expected-error 2{{lvalue reference}} - bad_decls& operator = (volatile bad_decls&) = default; // expected-error {{may not be volatile}} + bad_decls(volatile bad_decls&) = default; // expected-error {{may not be volatile}} expected-error {{must be defaulted outside the class}} + bad_decls&& operator = (bad_decls) = default; // expected-error {{lvalue reference}} expected-error {{must return 'bad_decls &'}} + bad_decls& operator = (volatile bad_decls&) = default; // expected-error {{may not be volatile}} expected-error {{must be defaulted outside the class}} bad_decls& operator = (const bad_decls&) const = default; // expected-error {{may not have 'const', 'constexpr' or 'volatile' qualifiers}} }; @@ -66,10 +70,9 @@ struct except_spec_d_mismatch : except_spec_a, except_spec_b { }; struct except_spec_d_match : except_spec_a, except_spec_b { except_spec_d_match() throw(A, B) = default; -}; +}; // gcc-compatibility: allow attributes on default definitions // (but not normal definitions) struct S { S(); }; S::S() __attribute((pure)) = default; - |