summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-04-02 20:59:25 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-04-02 20:59:25 +0000
commit6f1e2c6d19a7f1e7d2e169f6a850a04e7e58687d (patch)
treee383e153d0f8ed6c4b2eec7698dc4998c63327ff /clang/test
parent74ae3f5a4569a94beeef1a86a01868346d2f58aa (diff)
downloadbcm5719-llvm-6f1e2c6d19a7f1e7d2e169f6a850a04e7e58687d.tar.gz
bcm5719-llvm-6f1e2c6d19a7f1e7d2e169f6a850a04e7e58687d.zip
Finish PR10217: Ensure we say that a special member was implicitly, not
explicitly, deleted in all relevant cases, and explain why. llvm-svn: 153894
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/CXX/special/class.copy/implicit-move.cpp4
-rw-r--r--clang/test/CXX/special/class.ctor/p5-0x.cpp8
-rw-r--r--clang/test/CXX/special/class.dtor/p5-0x.cpp10
-rw-r--r--clang/test/SemaCXX/cxx0x-deleted-default-ctor.cpp6
-rw-r--r--clang/test/SemaCXX/dr1301.cpp4
5 files changed, 15 insertions, 17 deletions
diff --git a/clang/test/CXX/special/class.copy/implicit-move.cpp b/clang/test/CXX/special/class.copy/implicit-move.cpp
index 9cb4215cd0d..7c69dd8b87e 100644
--- a/clang/test/CXX/special/class.copy/implicit-move.cpp
+++ b/clang/test/CXX/special/class.copy/implicit-move.cpp
@@ -25,10 +25,10 @@ struct HasCopyAssignment {
HasCopyAssignment & operator =(const HasCopyAssignment &) noexcept(false);
};
-struct HasMoveConstructor { // expected-note {{implicit copy assignment}}
+struct HasMoveConstructor {
ThrowingCopy tc;
HasMoveConstructor() noexcept;
- HasMoveConstructor(HasMoveConstructor &&) noexcept;
+ HasMoveConstructor(HasMoveConstructor &&) noexcept; // expected-note {{deleted because 'HasMoveConstructor' has a user-declared move constructor}}
};
struct HasMoveAssignment { // expected-note {{implicit copy constructor}}
diff --git a/clang/test/CXX/special/class.ctor/p5-0x.cpp b/clang/test/CXX/special/class.ctor/p5-0x.cpp
index ceb47d8f3ba..694ab5b1753 100644
--- a/clang/test/CXX/special/class.ctor/p5-0x.cpp
+++ b/clang/test/CXX/special/class.ctor/p5-0x.cpp
@@ -31,11 +31,9 @@ NotDeleted1b nd1b;
// - any non-static data member with no brace-or-equal-initializer is of
// reference type,
class Deleted2a {
- // FIXME: We should explain that the function was implicitly deleted as a
- // result of being defaulted, and why.
- Deleted2a() = default; // expected-note 4{{explicitly marked deleted here}}
- int &a;
-};
+ Deleted2a() = default; // expected-note 4{{implicitly deleted here}}
+ int &a; // expected-note 4{{because field 'a' of reference type 'int &' would not be initialized}}
+};
Deleted2a d2a; // expected-error {{implicitly-deleted default constructor}}
struct Deleted2b {
int &&b; // expected-note {{default constructor of 'Deleted2b' is implicitly deleted because field 'b' of reference type 'int &&' would not be initialized}}
diff --git a/clang/test/CXX/special/class.dtor/p5-0x.cpp b/clang/test/CXX/special/class.dtor/p5-0x.cpp
index 19aa1190647..dbfa0044407 100644
--- a/clang/test/CXX/special/class.dtor/p5-0x.cpp
+++ b/clang/test/CXX/special/class.dtor/p5-0x.cpp
@@ -90,15 +90,15 @@ class D1 {
public:
virtual ~D1() = default;
} d1; // ok
-struct D2 : D1 { // expected-note {{deleted here}}
+struct D2 : D1 { // expected-note {{virtual destructor requires an unambiguous, accessible 'operator delete'}}
// implicitly-virtual destructor
} d2; // expected-error {{deleted function}}
-struct D3 {
- virtual ~D3() = default; // expected-note {{deleted here}}
+struct D3 { // expected-note {{virtual destructor requires an unambiguous, accessible 'operator delete'}}
+ virtual ~D3() = default; // expected-note {{explicitly defaulted function was implicitly deleted here}}
void operator delete(void*, double = 0.0);
void operator delete(void*, char = 0);
} d3; // expected-error {{deleted function}}
-struct D4 {
- virtual ~D4() = default; // expected-note {{deleted here}}
+struct D4 { // expected-note {{virtual destructor requires an unambiguous, accessible 'operator delete'}}
+ virtual ~D4() = default; // expected-note {{implicitly deleted here}}
void operator delete(void*) = delete;
} d4; // expected-error {{deleted function}}
diff --git a/clang/test/SemaCXX/cxx0x-deleted-default-ctor.cpp b/clang/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
index a5eaa352e4f..0cebc10ade4 100644
--- a/clang/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
+++ b/clang/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
@@ -59,7 +59,7 @@ struct good_const {
good_const gc;
struct no_default {
- no_default() = delete; // expected-note 2{{deleted here}}
+ no_default() = delete; // expected-note 3{{deleted here}}
};
struct no_dtor {
~no_dtor() = delete; // expected-note 2{{deleted here}}
@@ -108,8 +108,8 @@ struct has_friend {
has_friend hf;
struct defaulted_delete {
- no_default nd;
- defaulted_delete() = default; // expected-note{{deleted here}}
+ no_default nd; // expected-note {{because field 'nd' has a deleted default constructor}}
+ defaulted_delete() = default; // expected-note{{implicitly deleted here}}
};
defaulted_delete dd; // expected-error {{call to implicitly-deleted default constructor}}
diff --git a/clang/test/SemaCXX/dr1301.cpp b/clang/test/SemaCXX/dr1301.cpp
index c92ff9b714e..ec0db74554a 100644
--- a/clang/test/SemaCXX/dr1301.cpp
+++ b/clang/test/SemaCXX/dr1301.cpp
@@ -6,7 +6,7 @@ struct A { // expected-note 2{{candidate}}
int a = A().n; // expected-error {{no matching constructor}}
struct B {
- B() = delete; // expected-note 2{{here}}
+ B() = delete; // expected-note 3{{here}}
int n;
};
int b = B().n; // expected-error {{call to deleted}}
@@ -18,7 +18,7 @@ int c = C().b.n; // expected-error {{call to implicitly-deleted default}}
struct D {
D() = default; // expected-note {{here}}
- B b;
+ B b; // expected-note {{'b' has a deleted default constructor}}
};
int d = D().b.n; // expected-error {{call to implicitly-deleted default}}
OpenPOWER on IntegriCloud