diff options
Diffstat (limited to 'test/SemaCXX/cxx0x-cursory-default-delete.cpp')
-rw-r--r-- | test/SemaCXX/cxx0x-cursory-default-delete.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/SemaCXX/cxx0x-cursory-default-delete.cpp b/test/SemaCXX/cxx0x-cursory-default-delete.cpp index 375cf4a..dfca17a 100644 --- a/test/SemaCXX/cxx0x-cursory-default-delete.cpp +++ b/test/SemaCXX/cxx0x-cursory-default-delete.cpp @@ -25,7 +25,7 @@ void fn1 () { non_const_copy ncc2 = ncc; ncc = ncc2; const non_const_copy cncc{}; - const non_const_copy cncc1; // expected-error {{default initialization of an object of const type 'const non_const_copy' without a user-provided default constructor}} expected-note {{add an explicit initializer to initialize 'cncc1'}} + const non_const_copy cncc1; // expected-error {{default initialization of an object of const type 'const non_const_copy' without a user-provided default constructor}} non_const_copy ncc3 = cncc; // expected-error {{no matching}} ncc = cncc; // expected-error {{no viable overloaded}} }; @@ -42,6 +42,28 @@ struct bad_decls { bad_decls& operator = (const bad_decls&) const = default; // expected-error {{may not have 'const', 'constexpr' or 'volatile' qualifiers}} }; +struct DefaultDelete { + DefaultDelete() = default; // expected-note {{previous declaration is here}} + DefaultDelete() = delete; // expected-error {{constructor cannot be redeclared}} + + ~DefaultDelete() = default; // expected-note {{previous declaration is here}} + ~DefaultDelete() = delete; // expected-error {{destructor cannot be redeclared}} + + DefaultDelete &operator=(const DefaultDelete &) = default; // expected-note {{previous declaration is here}} + DefaultDelete &operator=(const DefaultDelete &) = delete; // expected-error {{class member cannot be redeclared}} +}; + +struct DeleteDefault { + DeleteDefault() = delete; // expected-note {{previous definition is here}} + DeleteDefault() = default; // expected-error {{constructor cannot be redeclared}} + + ~DeleteDefault() = delete; // expected-note {{previous definition is here}} + ~DeleteDefault() = default; // expected-error {{destructor cannot be redeclared}} + + DeleteDefault &operator=(const DeleteDefault &) = delete; // expected-note {{previous definition is here}} + DeleteDefault &operator=(const DeleteDefault &) = default; // expected-error {{class member cannot be redeclared}} +}; + struct A {}; struct B {}; struct except_spec_a { |