diff options
author | dim <dim@FreeBSD.org> | 2011-06-12 15:46:16 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-06-12 15:46:16 +0000 |
commit | c49018d9cce52d8c9f34b44865ec3ba8e89a1488 (patch) | |
tree | c5e9e10bc189de0058aa763c47b9920a8351b7df /test/SemaCXX/cxx0x-cursory-default-delete.cpp | |
parent | 110eaaceddcec790f7e6a5e3bf1261c9aa1e73ab (diff) | |
download | FreeBSD-src-c49018d9cce52d8c9f34b44865ec3ba8e89a1488.zip FreeBSD-src-c49018d9cce52d8c9f34b44865ec3ba8e89a1488.tar.gz |
Vendor import of clang trunk r132879:
http://llvm.org/svn/llvm-project/cfe/trunk@132879
Diffstat (limited to 'test/SemaCXX/cxx0x-cursory-default-delete.cpp')
-rw-r--r-- | test/SemaCXX/cxx0x-cursory-default-delete.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx0x-cursory-default-delete.cpp b/test/SemaCXX/cxx0x-cursory-default-delete.cpp new file mode 100644 index 0000000..61aee0e --- /dev/null +++ b/test/SemaCXX/cxx0x-cursory-default-delete.cpp @@ -0,0 +1,69 @@ +// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s + +struct non_copiable { + non_copiable(const non_copiable&) = delete; // expected-note {{marked deleted here}} + non_copiable& operator = (const non_copiable&) = delete; // expected-note {{explicitly deleted}} + non_copiable() = default; +}; + +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() = default; // expected-note {{not viable}} +}; + +void fn1 () { + non_copiable nc; + non_copiable nc2 = nc; // expected-error {{deleted constructor}} + nc = nc; // expected-error {{deleted operator}} + + non_const_copy ncc; + non_const_copy ncc2 = ncc; + ncc = ncc2; + const non_const_copy cncc; + non_const_copy ncc3 = cncc; // expected-error {{no matching}} + ncc = cncc; // expected-error {{no viable overloaded}} +}; + +struct non_const_derived : non_const_copy { + non_const_derived(const non_const_derived&) = default; // expected-error {{requires it to be non-const}} + non_const_derived& operator =(non_const_derived&) = default; +}; + +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& operator = (const bad_decls&) const = default; // expected-error {{may not have 'const' or 'volatile' qualifiers}} +}; + +struct A {}; struct B {}; + +struct except_spec_a { + virtual ~except_spec_a() throw(A); + except_spec_a() throw(A); +}; +struct except_spec_b { + virtual ~except_spec_b() throw(B); + except_spec_b() throw(B); +}; + +struct except_spec_d_good : except_spec_a, except_spec_b { + ~except_spec_d_good(); +}; +except_spec_d_good::~except_spec_d_good() = default; +// FIXME: This should error in the virtual override check. +// It doesn't because we generate the implicit specification later than +// appropriate. +struct except_spec_d_bad : except_spec_a, except_spec_b { + ~except_spec_d_bad() = default; +}; + +// FIXME: This should error because the exceptions spec doesn't match. +struct except_spec_d_mismatch : except_spec_a, except_spec_b { + except_spec_d_mismatch() throw(A) = default; +}; +struct except_spec_d_match : except_spec_a, except_spec_b { + except_spec_d_match() throw(A, B) = default; +}; |