aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2012-03-30 20:53:28 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2012-03-30 20:53:28 +0000
commit6c4c36c4ed1007143f5b8655eb68b313a7e12e76 (patch)
tree0a912935dcb75afa09172e2aabf7b40a71653f2e /test
parent0f30a12ce7b3d4d86c9ca9072f587da77c8eef34 (diff)
PR10217: Provide diagnostics explaining why an implicitly-deleted special
member function is deleted. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@153773 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp4
-rw-r--r--test/CXX/special/class.copy/implicit-move.cpp6
-rw-r--r--test/CXX/special/class.copy/p11.0x.copy.cpp36
-rw-r--r--test/CXX/special/class.copy/p11.0x.move.cpp4
-rw-r--r--test/CXX/special/class.ctor/p5-0x.cpp59
-rw-r--r--test/CXX/special/class.dtor/p5-0x.cpp55
-rw-r--r--test/SemaCXX/cxx0x-deleted-default-ctor.cpp46
-rw-r--r--test/SemaCXX/cxx98-compat-flags.cpp6
-rw-r--r--test/SemaCXX/cxx98-compat.cpp6
-rw-r--r--test/SemaCXX/defaulted-private-dtor.cpp6
-rw-r--r--test/SemaCXX/dr1301.cpp22
-rw-r--r--test/SemaCXX/implicit-exception-spec.cpp4
-rw-r--r--test/SemaCXX/value-initialization.cpp5
13 files changed, 132 insertions, 127 deletions
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
index 47efde2db0..7764980e34 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
@@ -8,7 +8,7 @@ private:
protected:
struct Inner { int m; };
public:
- bool &br;
+ bool &br; // expected-note {{default constructor of 'Aggr' is implicitly deleted because field 'br' of reference type 'bool &' would not be initialized}}
};
bool b;
Aggr ag = { b };
@@ -54,7 +54,7 @@ struct NonAggr5 : Aggr { // expected-note 3 {{candidate constructor}}
};
NonAggr5 na5 = { b }; // expected-error {{no matching constructor for initialization of 'NonAggr5'}}
template<typename...BaseList>
-struct MaybeAggr5a : BaseList... {}; // expected-note {{defined here}}
+struct MaybeAggr5a : BaseList... {}; // expected-note {{default constructor of 'MaybeAggr5a<Aggr>' is implicitly deleted because base class 'Aggr' has a deleted default constructor}}
MaybeAggr5a<> ma5a0 = {}; // ok
MaybeAggr5a<Aggr> ma5a1 = {}; // expected-error {{call to implicitly-deleted default constructor of 'MaybeAggr5a<Aggr>'}}
diff --git a/test/CXX/special/class.copy/implicit-move.cpp b/test/CXX/special/class.copy/implicit-move.cpp
index cc39af97ae..9ff6f48fad 100644
--- a/test/CXX/special/class.copy/implicit-move.cpp
+++ b/test/CXX/special/class.copy/implicit-move.cpp
@@ -87,9 +87,9 @@ private:
~PrivateDestructor() noexcept;
};
-struct InheritsPrivateDestructor : PrivateDestructor {}; // expected-note{{defined here}}
-struct ContainsPrivateDestructor { // expected-note{{defined here}}
- PrivateDestructor pd;
+struct InheritsPrivateDestructor : PrivateDestructor {}; // expected-note{{base class 'PrivateDestructor' has an inaccessible destructor}}
+struct ContainsPrivateDestructor {
+ PrivateDestructor pd; // expected-note{{field 'pd' has an inaccessible destructor}}
};
struct NonTrivialCopyOnly {
diff --git a/test/CXX/special/class.copy/p11.0x.copy.cpp b/test/CXX/special/class.copy/p11.0x.copy.cpp
index cbe62b41cb..b2b4f6a87f 100644
--- a/test/CXX/special/class.copy/p11.0x.copy.cpp
+++ b/test/CXX/special/class.copy/p11.0x.copy.cpp
@@ -7,16 +7,16 @@ struct NonTrivial {
// A defaulted copy constructor for a class X is defined as deleted if X has:
// -- a variant member with a non-trivial corresponding constructor
-union DeletedNTVariant { // expected-note{{here}}
- NonTrivial NT;
+union DeletedNTVariant {
+ NonTrivial NT; // expected-note{{copy constructor of union 'DeletedNTVariant' is implicitly deleted because field 'NT' has a non-trivial copy constructor}}
DeletedNTVariant();
};
DeletedNTVariant DVa;
DeletedNTVariant DVb(DVa); // expected-error{{call to implicitly-deleted copy constructor}}
-struct DeletedNTVariant2 { // expected-note{{here}}
+struct DeletedNTVariant2 {
union {
- NonTrivial NT;
+ NonTrivial NT; // expected-note{{copy constructor of union 'DeletedNTVariant2' is implicitly deleted because field 'NT' has a non-trivial copy constructor}}
};
DeletedNTVariant2();
};
@@ -34,8 +34,8 @@ private:
friend struct HasAccess;
};
-struct HasNoAccess { // expected-note{{here}}
- NoAccess NA;
+struct HasNoAccess {
+ NoAccess NA; // expected-note{{copy constructor of 'HasNoAccess' is implicitly deleted because field 'NA' has an inaccessible copy constructor}}
};
HasNoAccess HNAa;
HasNoAccess HNAb(HNAa); // expected-error{{call to implicitly-deleted copy constructor}}
@@ -55,16 +55,16 @@ struct Ambiguity {
Ambiguity(volatile Ambiguity&);
};
-struct IsAmbiguous { // expected-note{{here}}
+struct IsAmbiguous {
NonConst NC;
- Ambiguity A;
+ Ambiguity A; // expected-note 2{{copy constructor of 'IsAmbiguous' is implicitly deleted because field 'A' has multiple copy constructors}}
IsAmbiguous();
};
IsAmbiguous IAa;
IsAmbiguous IAb(IAa); // expected-error{{call to implicitly-deleted copy constructor}}
-struct Deleted { // expected-note{{here}}
- IsAmbiguous IA;
+struct Deleted {
+ IsAmbiguous IA; // expected-note{{copy constructor of 'Deleted' is implicitly deleted because field 'IA' has a deleted copy constructor}}
};
Deleted Da;
Deleted Db(Da); // expected-error{{call to implicitly-deleted copy constructor}}
@@ -72,17 +72,17 @@ Deleted Db(Da); // expected-error{{call to implicitly-deleted copy constructor}}
// -- a direct or virtual base class B that cannot be copied because overload
// resolution results in an ambiguity or a function that is deleted or
// inaccessible
-struct AmbiguousCopyBase : Ambiguity { // expected-note {{here}}
+struct AmbiguousCopyBase : Ambiguity { // expected-note 2{{copy constructor of 'AmbiguousCopyBase' is implicitly deleted because base class 'Ambiguity' has multiple copy constructors}}
NonConst NC;
};
extern AmbiguousCopyBase ACBa;
AmbiguousCopyBase ACBb(ACBa); // expected-error {{deleted copy constructor}}
-struct DeletedCopyBase : AmbiguousCopyBase {}; // expected-note {{here}}
+struct DeletedCopyBase : AmbiguousCopyBase {}; // expected-note {{copy constructor of 'DeletedCopyBase' is implicitly deleted because base class 'AmbiguousCopyBase' has a deleted copy constructor}}
extern DeletedCopyBase DCBa;
DeletedCopyBase DCBb(DCBa); // expected-error {{deleted copy constructor}}
-struct InaccessibleCopyBase : NoAccess {}; // expected-note {{here}}
+struct InaccessibleCopyBase : NoAccess {}; // expected-note {{copy constructor of 'InaccessibleCopyBase' is implicitly deleted because base class 'NoAccess' has an inaccessible copy constructor}}
extern InaccessibleCopyBase ICBa;
InaccessibleCopyBase ICBb(ICBa); // expected-error {{deleted copy constructor}}
@@ -94,8 +94,8 @@ private:
friend struct HasAccessDtor;
};
-struct HasNoAccessDtor { // expected-note{{here}}
- NoAccessDtor NAD;
+struct HasNoAccessDtor {
+ NoAccessDtor NAD; // expected-note{{copy constructor of 'HasNoAccessDtor' is implicitly deleted because field 'NAD' has an inaccessible destructor}}
HasNoAccessDtor();
~HasNoAccessDtor();
};
@@ -108,14 +108,14 @@ struct HasAccessDtor {
HasAccessDtor HADa;
HasAccessDtor HADb(HADa);
-struct HasNoAccessDtorBase : NoAccessDtor { // expected-note{{here}}
+struct HasNoAccessDtorBase : NoAccessDtor { // expected-note{{copy constructor of 'HasNoAccessDtorBase' is implicitly deleted because base class 'NoAccessDtor' has an inaccessible destructor}}
};
extern HasNoAccessDtorBase HNADBa;
HasNoAccessDtorBase HNADBb(HNADBa); // expected-error{{implicitly-deleted copy constructor}}
// -- a non-static data member of rvalue reference type
-struct RValue { // expected-note{{here}}
- int && ri = 1;
+struct RValue {
+ int && ri = 1; // expected-note{{copy constructor of 'RValue' is implicitly deleted because field 'ri' is of rvalue reference type 'int &&'}}
};
RValue RVa;
RValue RVb(RVa); // expected-error{{call to implicitly-deleted copy constructor}}
diff --git a/test/CXX/special/class.copy/p11.0x.move.cpp b/test/CXX/special/class.copy/p11.0x.move.cpp
index 5315b060a0..3e9cc6b662 100644
--- a/test/CXX/special/class.copy/p11.0x.move.cpp
+++ b/test/CXX/special/class.copy/p11.0x.move.cpp
@@ -82,7 +82,7 @@ InaccessibleMoveBase::InaccessibleMoveBase(InaccessibleMoveBase&&) = default; //
// -- any direct or virtual base class or non-static data member of a type with
// a destructor that is deleted or inaccessible
struct NoAccessDtor {
- NoAccessDtor(NoAccessDtor&&);
+ NoAccessDtor(NoAccessDtor&&); // expected-note{{copy constructor is implicitly deleted because 'NoAccessDtor' has a user-declared move constructor}}
private:
~NoAccessDtor();
friend struct HasAccessDtor;
@@ -100,7 +100,7 @@ struct HasAccessDtor {
};
HasAccessDtor::HasAccessDtor(HasAccessDtor&&) = default;
-struct HasNoAccessDtorBase : NoAccessDtor { // expected-note{{here}}
+struct HasNoAccessDtorBase : NoAccessDtor { // expected-note{{copy constructor of 'HasNoAccessDtorBase' is implicitly deleted because base class 'NoAccessDtor' has a deleted copy constructor}}
};
extern HasNoAccessDtorBase HNADBa;
HasNoAccessDtorBase HNADBb(HNADBa); // expected-error{{implicitly-deleted copy constructor}}
diff --git a/test/CXX/special/class.ctor/p5-0x.cpp b/test/CXX/special/class.ctor/p5-0x.cpp
index 6f43446674..ceb47d8f3b 100644
--- a/test/CXX/special/class.ctor/p5-0x.cpp
+++ b/test/CXX/special/class.ctor/p5-0x.cpp
@@ -2,9 +2,9 @@
struct DefaultedDefCtor1 {};
struct DefaultedDefCtor2 { DefaultedDefCtor2() = default; };
-struct DeletedDefCtor { DeletedDefCtor() = delete; DeletedDefCtor(int); };
+struct DeletedDefCtor { DeletedDefCtor() = delete; DeletedDefCtor(int); }; // expected-note {{explicitly marked deleted here}}
class PrivateDefCtor { PrivateDefCtor() = default; public: PrivateDefCtor(int); };
-struct DeletedDtor { ~DeletedDtor() = delete; };
+struct DeletedDtor { ~DeletedDtor() = delete; }; // expected-note 4{{explicitly marked deleted here}}
class PrivateDtor { ~PrivateDtor() = default; };
class Friend {
Friend() = default; ~Friend() = default;
@@ -21,7 +21,7 @@ int n;
// - X is a union-like class that has a variant member with a non-trivial
// default constructor,
-union Deleted1a { UserProvidedDefCtor u; }; // expected-note {{defined here}}
+union Deleted1a { UserProvidedDefCtor u; }; // expected-note {{default constructor of union 'Deleted1a' is implicitly deleted because field 'u' has a non-trivial default constructor}}
Deleted1a d1a; // expected-error {{implicitly-deleted default constructor}}
union NotDeleted1a { DefaultedDefCtor1 nu; };
NotDeleted1a nd1a;
@@ -30,13 +30,15 @@ NotDeleted1b nd1b;
// - any non-static data member with no brace-or-equal-initializer is of
// reference type,
-class Deleted2a { // expected-note {{defined here}}
- Deleted2a() = default; // expected-note {{declared here}}
+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 d2a; // expected-error {{implicitly-deleted default constructor}}
-struct Deleted2b { // expected-note {{here}}
- int &&b;
+struct Deleted2b {
+ int &&b; // expected-note {{default constructor of 'Deleted2b' is implicitly deleted because field 'b' of reference type 'int &&' would not be initialized}}
};
Deleted2b d2b; // expected-error {{deleted default constructor}}
class NotDeleted2a { int &a = n; };
@@ -49,13 +51,13 @@ NotDeleted2c nd2c;
// - any non-variant non-static data member of const qualified type (or array
// thereof) with no brace-or-equal-initializer does not have a user-provided
// default constructor,
-class Deleted3a { const int a; }; // expected-note {{here}} \
+class Deleted3a { const int a; }; // expected-note {{because field 'a' of const-qualified type 'const int' would not be initialized}} \
expected-warning {{does not declare any constructor}} \
expected-note {{will never be initialized}}
Deleted3a d3a; // expected-error {{implicitly-deleted default constructor}}
-class Deleted3b { const DefaultedDefCtor1 a[42]; }; // expected-note {{here}}
+class Deleted3b { const DefaultedDefCtor1 a[42]; }; // expected-note {{because field 'a' of const-qualified type 'const DefaultedDefCtor1' would not be initialized}}
Deleted3b d3b; // expected-error {{implicitly-deleted default constructor}}
-class Deleted3c { const DefaultedDefCtor2 a; }; // expected-note {{defined here}}
+class Deleted3c { const DefaultedDefCtor2 a; }; // expected-note {{because field 'a' of const-qualified type 'const DefaultedDefCtor2' would not be initialized}}
Deleted3c d3c; // expected-error {{implicitly-deleted default constructor}}
class NotDeleted3a { const int a = 0; };
NotDeleted3a nd3a;
@@ -74,14 +76,21 @@ NotDeleted3g nd3g;
// - X is a union and all of its variant members are of const-qualified type (or
// array thereof),
-union Deleted4a { const int a; const int b; const UserProvidedDefCtor c; }; // expected-note {{here}}
+union Deleted4a {
+ const int a;
+ const int b;
+ const UserProvidedDefCtor c; // expected-note {{because field 'c' has a non-trivial default constructor}}
+};
Deleted4a d4a; // expected-error {{implicitly-deleted default constructor}}
union NotDeleted4a { const int a; int b; };
NotDeleted4a nd4a;
// - X is a non-union class and all members of any anonymous union member are of
// const-qualified type (or array thereof),
-struct Deleted5a { union { const int a; }; union { int b; }; }; // expected-note {{here}}
+struct Deleted5a {
+ union { const int a; }; // expected-note {{because all data members of an anonymous union member are const-qualified}}
+ union { int b; };
+};
Deleted5a d5a; // expected-error {{implicitly-deleted default constructor}}
struct NotDeleted5a { union { const int a; int b; }; union { const int c; int d; }; };
NotDeleted5a nd5a;
@@ -91,17 +100,17 @@ NotDeleted5a nd5a;
// M has no default constructor or overload resolution as applied to M's default
// constructor results in an ambiguity or in a function that is deleted or
// inaccessible from the defaulted default constructor, or
-struct Deleted6a : Deleted2a {}; // expected-note {{here}}
+struct Deleted6a : Deleted2a {}; // expected-note {{because base class 'Deleted2a' has a deleted default constructor}}
Deleted6a d6a; // expected-error {{implicitly-deleted default constructor}}
-struct Deleted6b : virtual Deleted2a {}; // expected-note {{here}}
+struct Deleted6b : virtual Deleted2a {}; // expected-note {{because base class 'Deleted2a' has a deleted default constructor}}
Deleted6b d6b; // expected-error {{implicitly-deleted default constructor}}
-struct Deleted6c { Deleted2a a; }; // expected-note {{here}}
+struct Deleted6c { Deleted2a a; }; // expected-note {{because field 'a' has a deleted default constructor}}
Deleted6c d6c; // expected-error {{implicitly-deleted default constructor}}
-struct Deleted6d { DeletedDefCtor a; }; // expected-note {{here}}
+struct Deleted6d { DeletedDefCtor a; }; // expected-note {{because field 'a' has a deleted default constructor}}
Deleted6d d6d; // expected-error {{implicitly-deleted default constructor}}
struct NotDeleted6a { DeletedDefCtor a = 0; };
NotDeleted6a nd6a;
-struct Deleted6e { PrivateDefCtor a; }; // expected-note {{here}}
+struct Deleted6e { PrivateDefCtor a; }; // expected-note {{because field 'a' has an inaccessible default constructor}}
Deleted6e d6e; // expected-error {{implicitly-deleted default constructor}}
struct NotDeleted6b { PrivateDefCtor a = 0; };
NotDeleted6b nd6b;
@@ -111,21 +120,21 @@ NotDeleted6c nd6c;
// - any direct or virtual base class or non-static data member has a type with
// a destructor that is deleted or inaccessible from the defaulted default
// constructor.
-struct Deleted7a : DeletedDtor {}; // expected-note {{here}}
+struct Deleted7a : DeletedDtor {}; // expected-note {{because base class 'DeletedDtor' has a deleted destructor}}
Deleted7a d7a; // expected-error {{implicitly-deleted default constructor}}
-struct Deleted7b : virtual DeletedDtor {}; // expected-note {{here}}
+struct Deleted7b : virtual DeletedDtor {}; // expected-note {{because base class 'DeletedDtor' has a deleted destructor}}
Deleted7b d7b; // expected-error {{implicitly-deleted default constructor}}
-struct Deleted7c { DeletedDtor a; }; // expected-note {{here}}
+struct Deleted7c { DeletedDtor a; }; // expected-note {{because field 'a' has a deleted destructor}}
Deleted7c d7c; // expected-error {{implicitly-deleted default constructor}}
-struct Deleted7d { DeletedDtor a = {}; }; // expected-note {{here}}
+struct Deleted7d { DeletedDtor a = {}; }; // expected-note {{because field 'a' has a deleted destructor}}
Deleted7d d7d; // expected-error {{implicitly-deleted default constructor}}
-struct Deleted7e : PrivateDtor {}; // expected-note {{here}}
+struct Deleted7e : PrivateDtor {}; // expected-note {{base class 'PrivateDtor' has an inaccessible destructor}}
Deleted7e d7e; // expected-error {{implicitly-deleted default constructor}}
-struct Deleted7f : virtual PrivateDtor {}; // expected-note {{here}}
+struct Deleted7f : virtual PrivateDtor {}; // expected-note {{base class 'PrivateDtor' has an inaccessible destructor}}
Deleted7f d7f; // expected-error {{implicitly-deleted default constructor}}
-struct Deleted7g { PrivateDtor a; }; // expected-note {{here}}
+struct Deleted7g { PrivateDtor a; }; // expected-note {{field 'a' has an inaccessible destructor}}
Deleted7g d7g; // expected-error {{implicitly-deleted default constructor}}
-struct Deleted7h { PrivateDtor a = {}; }; // expected-note {{here}}
+struct Deleted7h { PrivateDtor a = {}; }; // expected-note {{field 'a' has an inaccessible destructor}}
Deleted7h d7h; // expected-error {{implicitly-deleted default constructor}}
struct NotDeleted7i : Friend {};
NotDeleted7i d7i;
diff --git a/test/CXX/special/class.dtor/p5-0x.cpp b/test/CXX/special/class.dtor/p5-0x.cpp
index cb7038aa9c..19aa119064 100644
--- a/test/CXX/special/class.dtor/p5-0x.cpp
+++ b/test/CXX/special/class.dtor/p5-0x.cpp
@@ -4,7 +4,7 @@ struct NonTrivDtor {
~NonTrivDtor();
};
struct DeletedDtor {
- ~DeletedDtor() = delete;
+ ~DeletedDtor() = delete; // expected-note 5 {{deleted here}}
};
class InaccessibleDtor {
~InaccessibleDtor() = default;
@@ -14,73 +14,74 @@ class InaccessibleDtor {
// -- X is a union-like class that has a variant member with a non-trivial
// destructor.
-union A1 { // expected-note {{here}}
+union A1 {
A1();
- NonTrivDtor n;
+ NonTrivDtor n; // expected-note {{destructor of union 'A1' is implicitly deleted because field 'n' has a non-trivial destructor}}
};
A1 a1; // expected-error {{deleted function}}
-struct A2 { // expected-note {{here}}
+struct A2 {
A2();
union {
- NonTrivDtor n;
+ NonTrivDtor n; // expected-note {{because field 'n' has a non-trivial destructor}}
};
};
A2 a2; // expected-error {{deleted function}}
-union A3 { // expected-note {{here}}
+union A3 {
A3();
- NonTrivDtor n[3];
+ NonTrivDtor n[3]; // expected-note {{because field 'n' has a non-trivial destructor}}
};
A3 a3; // expected-error {{deleted function}}
-struct A4 { // expected-note {{here}}
+struct A4 {
A4();
union {
- NonTrivDtor n[3];
+ NonTrivDtor n[3]; // expected-note {{because field 'n' has a non-trivial destructor}}
};
};
A4 a4; // expected-error {{deleted function}}
// -- any of the non-static data members has class type M (or array thereof) and
// M has a deleted or inaccessible destructor.
-struct B1 { // expected-note {{here}}
+struct B1 {
B1();
- DeletedDtor a;
+ DeletedDtor a; // expected-note {{because field 'a' has a deleted destructor}}
};
B1 b1; // expected-error {{deleted function}}
-struct B2 { // expected-note {{here}}
+struct B2 {
B2();
- InaccessibleDtor a;
+ InaccessibleDtor a; // expected-note {{because field 'a' has an inaccessible destructor}}
};
B2 b2; // expected-error {{deleted function}}
-struct B3 { // expected-note {{here}}
+struct B3 {
B3();
- DeletedDtor a[4];
+ DeletedDtor a[4]; // expected-note {{because field 'a' has a deleted destructor}}
};
B3 b3; // expected-error {{deleted function}}
-struct B4 { // expected-note {{here}}
+struct B4 {
B4();
- InaccessibleDtor a[4];
+ InaccessibleDtor a[4]; // expected-note {{because field 'a' has an inaccessible destructor}}
};
B4 b4; // expected-error {{deleted function}}
-union B5 { // expected-note {{here}}
+union B5 {
B5();
- union {
- DeletedDtor a;
+ // FIXME: Describe the anonymous union member better than ''.
+ union { // expected-note {{because field '' has a deleted destructor}}
+ DeletedDtor a; // expected-note {{because field 'a' has a deleted destructor}}
};
};
B5 b5; // expected-error {{deleted function}}
-union B6 { // expected-note {{here}}
+union B6 {
B6();
- union {
- InaccessibleDtor a;
+ union { // expected-note {{because field '' has a deleted destructor}}
+ InaccessibleDtor a; // expected-note {{because field 'a' has an inaccessible destructor}}
};
};
B6 b6; // expected-error {{deleted function}}
// -- any direct or virtual base class has a deleted or inaccessible destructor.
-struct C1 : DeletedDtor { C1(); } c1; // expected-error {{deleted function}} expected-note {{here}}
-struct C2 : InaccessibleDtor { C2(); } c2; // expected-error {{deleted function}} expected-note {{here}}
-struct C3 : virtual DeletedDtor { C3(); } c3; // expected-error {{deleted function}} expected-note {{here}}
-struct C4 : virtual InaccessibleDtor { C4(); } c4; // expected-error {{deleted function}} expected-note {{here}}
+struct C1 : DeletedDtor { C1(); } c1; // expected-error {{deleted function}} expected-note {{base class 'DeletedDtor' has a deleted destructor}}
+struct C2 : InaccessibleDtor { C2(); } c2; // expected-error {{deleted function}} expected-note {{base class 'InaccessibleDtor' has an inaccessible destructor}}
+struct C3 : virtual DeletedDtor { C3(); } c3; // expected-error {{deleted function}} expected-note {{base class 'DeletedDtor' has a deleted destructor}}
+struct C4 : virtual InaccessibleDtor { C4(); } c4; // expected-error {{deleted function}} expected-note {{base class 'InaccessibleDtor' has an inaccessible destructor}}
// -- for a virtual destructor, lookup of the non-array deallocation function
// results in an ambiguity or a function that is deleted or inaccessible.
diff --git a/test/SemaCXX/cxx0x-deleted-default-ctor.cpp b/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
index f6e5593d85..a5eaa352e4 100644
--- a/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
+++ b/test/SemaCXX/cxx0x-deleted-default-ctor.cpp
@@ -7,23 +7,23 @@ struct non_trivial {
~non_trivial();
};
-union bad_union { // expected-note {{defined here}}
- non_trivial nt;
+union bad_union {
+ non_trivial nt; // expected-note {{non-trivial default constructor}}
};
bad_union u; // expected-error {{call to implicitly-deleted default constructor}}
-union bad_union2 { // expected-note {{defined here}}
+union bad_union2 { // expected-note {{all data members are const-qualified}}
const int i;
};
bad_union2 u2; // expected-error {{call to implicitly-deleted default constructor}}
-struct bad_anon { // expected-note {{defined here}}
+struct bad_anon {
union {
- non_trivial nt;
+ non_trivial nt; // expected-note {{non-trivial default constructor}}
};
};
bad_anon a; // expected-error {{call to implicitly-deleted default constructor}}
-struct bad_anon2 { // expected-note {{defined here}}
- union {
+struct bad_anon2 {
+ union { // expected-note {{all data members of an anonymous union member are const-qualified}}
const int i;
};
};
@@ -48,8 +48,8 @@ struct good : non_trivial {
};
good g;
-struct bad_const { // expected-note {{defined here}}
- const good g;
+struct bad_const {
+ const good g; // expected-note {{field 'g' of const-qualified type 'const good' would not be initialized}}
};
bad_const bc; // expected-error {{call to implicitly-deleted default constructor}}
@@ -59,25 +59,25 @@ struct good_const {
good_const gc;
struct no_default {
- no_default() = delete;
+ no_default() = delete; // expected-note 2{{deleted here}}
};
struct no_dtor {
- ~no_dtor() = delete;
+ ~no_dtor() = delete; // expected-note 2{{deleted here}}
};
-struct bad_field_default { // expected-note {{defined here}}
- no_default nd;
+struct bad_field_default {
+ no_default nd; // expected-note {{field 'nd' has a deleted default constructor}}
};
bad_field_default bfd; // expected-error {{call to implicitly-deleted default constructor}}
-struct bad_base_default : no_default { // expected-note {{defined here}}
+struct bad_base_default : no_default { // expected-note {{base class 'no_default' has a deleted default constructor}}
};
bad_base_default bbd; // expected-error {{call to implicitly-deleted default constructor}}
-struct bad_field_dtor { // expected-note {{defined here}}
- no_dtor nd;
+struct bad_field_dtor {
+ no_dtor nd; // expected-note {{field 'nd' has a deleted destructor}}
};
bad_field_dtor bfx; // expected-error {{call to implicitly-deleted default constructor}}
-struct bad_base_dtor : no_dtor { // expected-note {{defined here}}
+struct bad_base_dtor : no_dtor { // expected-note {{base class 'no_dtor' has a deleted destructor}}
};
bad_base_dtor bbx; // expected-error {{call to implicitly-deleted default constructor}}
@@ -85,16 +85,16 @@ struct ambiguous_default {
ambiguous_default();
ambiguous_default(int = 2);
};
-struct has_amb_field { // expected-note {{defined here}}
- ambiguous_default ad;
+struct has_amb_field {
+ ambiguous_default ad; // expected-note {{field 'ad' has multiple default constructors}}
};
has_amb_field haf; // expected-error {{call to implicitly-deleted default constructor}}
class inaccessible_default {
inaccessible_default();
};
-struct has_inacc_field { // expected-note {{defined here}}
- inaccessible_default id;
+struct has_inacc_field {
+ inaccessible_default id; // expected-note {{field 'id' has an inaccessible default constructor}}
};
has_inacc_field hif; // expected-error {{call to implicitly-deleted default constructor}}
@@ -107,9 +107,9 @@ struct has_friend {
};
has_friend hf;
-struct defaulted_delete { // expected-note {{defined here}}
+struct defaulted_delete {
no_default nd;
- defaulted_delete() = default; // expected-note{{declared here}}
+ defaulted_delete() = default; // expected-note{{deleted here}}
};
defaulted_delete dd; // expected-error {{call to implicitly-deleted default constructor}}
diff --git a/test/SemaCXX/cxx98-compat-flags.cpp b/test/SemaCXX/cxx98-compat-flags.cpp
index fcc048a36d..6dc24be6bb 100644
--- a/test/SemaCXX/cxx98-compat-flags.cpp
+++ b/test/SemaCXX/cxx98-compat-flags.cpp
@@ -24,10 +24,8 @@ namespace CopyCtorIssues {
Ambiguous(const Ambiguous &, int = 0); // expected-note {{candidate}}
Ambiguous(const Ambiguous &, double = 0); // expected-note {{candidate}}
};
- struct Deleted { // expected-note {{here}}
- // Copy ctor implicitly defined as deleted because Private's copy ctor is
- // inaccessible.
- Private p;
+ struct Deleted {
+ Private p; // expected-note {{copy constructor of 'Deleted' is implicitly deleted because field 'p' has an inaccessible copy constructor}}
};
const Private &a = Private(); // expected-warning {{copying variable of type 'CopyCtorIssues::Private' when binding a reference to a temporary would invoke an inaccessible constructor in C++98}}
diff --git a/test/SemaCXX/cxx98-compat.cpp b/test/SemaCXX/cxx98-compat.cpp
index fd70875fc8..70cac8d54e 100644
--- a/test/SemaCXX/cxx98-compat.cpp
+++ b/test/SemaCXX/cxx98-compat.cpp
@@ -214,10 +214,8 @@ namespace CopyCtorIssues {
Ambiguous(const Ambiguous &, int = 0); // expected-note {{candidate}}
Ambiguous(const Ambiguous &, double = 0); // expected-note {{candidate}}
};
- struct Deleted { // expected-note {{here}}
- // Copy ctor implicitly defined as deleted because Private's copy ctor is
- // inaccessible.
- Private p;
+ struct Deleted {
+ Private p; // expected-note {{implicitly deleted}}
};
const Private &a = Private(); // expected-warning {{copying variable of type 'CopyCtorIssues::Private' when binding a reference to a temporary would invoke an inaccessible constructor in C++98}}
diff --git a/test/SemaCXX/defaulted-private-dtor.cpp b/test/SemaCXX/defaulted-private-dtor.cpp
index 600dc3ca61..e6f955501a 100644
--- a/test/SemaCXX/defaulted-private-dtor.cpp
+++ b/test/SemaCXX/defaulted-private-dtor.cpp
@@ -12,12 +12,12 @@ void f() {
BadDtor dd; // expected-error {{private destructor}}
throw dd; // expected-error {{private destructor}}
}
-struct V { // expected-note {{here}}
+struct V {
V();
- BadDtor bd;
+ BadDtor bd; // expected-note {{inaccessible destructor}}
};
V v; // expected-error {{deleted function}}
-struct W : BadDtor { // expected-note {{here}}
+struct W : BadDtor { // expected-note {{inaccessible destructor}}
W();
};
W w; // expected-error {{deleted function}}
diff --git a/test/SemaCXX/dr1301.cpp b/test/SemaCXX/dr1301.cpp
index a348977f50..c92ff9b714 100644
--- a/test/SemaCXX/dr1301.cpp
+++ b/test/SemaCXX/dr1301.cpp
@@ -6,18 +6,18 @@ struct A { // expected-note 2{{candidate}}
int a = A().n; // expected-error {{no matching constructor}}
struct B {
- B() = delete; // expected-note {{here}}
+ B() = delete; // expected-note 2{{here}}
int n;
};
int b = B().n; // expected-error {{call to deleted}}
-struct C { // expected-note {{here}}
- B b;
+struct C {
+ B b; // expected-note {{deleted default constructor}}
};
int c = C().b.n; // expected-error {{call to implicitly-deleted default}}
-struct D { // expected-note {{defined here}}
- D() = default; // expected-note {{declared here}}
+struct D {
+ D() = default; // expected-note {{here}}
B b;
};
int d = D().b.n; // expected-error {{call to implicitly-deleted default}}
@@ -34,8 +34,8 @@ struct F {
};
int f = F().n; // ok
-union G { // expected-note {{here}}
- F f;
+union G {
+ F f; // expected-note {{non-trivial default constructor}}
};
int g = G().f.n; // expected-error {{call to implicitly-deleted default}}
@@ -46,8 +46,8 @@ private:
};
int h = H().n; // expected-error {{private constructor}}
-struct I { // expected-note {{here}}
- H h;
+struct I {
+ H h; // expected-note {{inaccessible default constructor}}
};
int i = I().h.n; // expected-error {{call to implicitly-deleted default}}
@@ -59,8 +59,8 @@ struct J {
int j1 = J().n; // ok
int j2 = J().f(); // ok
-union K { // expected-note 2{{here}}
- J j;
+union K {
+ J j; // expected-note 2{{non-trivial default constructor}}
int m;
};
int k1 = K().j.n; // expected-error {{call to implicitly-deleted default}}
diff --git a/test/SemaCXX/implicit-exception-spec.cpp b/test/SemaCXX/implicit-exception-spec.cpp
index f8ee76727e..786e8f4a14 100644
--- a/test/SemaCXX/implicit-exception-spec.cpp
+++ b/test/SemaCXX/implicit-exception-spec.cpp
@@ -54,9 +54,9 @@ namespace ExceptionSpecification {
// The same problem arises in delayed parsing of default arguments,
// which clang does not yet support.
namespace DefaultArgument {
- struct Default { // expected-note {{defined here}}
+ struct Default {
struct T {
T(int = ExceptionIf<noexcept(Default())::f()); // expected-error {{call to implicitly-deleted default constructor}}
- } t;
+ } t; // expected-note {{has no default constructor}}
};
}
diff --git a/test/SemaCXX/value-initialization.cpp b/test/SemaCXX/value-initialization.cpp
index 3b552e2a42..4e3acbb767 100644
--- a/test/SemaCXX/value-initialization.cpp
+++ b/test/SemaCXX/value-initialization.cpp
@@ -1,8 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
-struct A { //expected-note {{defined here}} \
- // expected-warning {{does not declare any constructor to initialize}}
- const int i; // expected-note{{const member 'i' will never be initialized}}
+struct A { // expected-warning {{does not declare any constructor to initialize}}
+ const int i; // expected-note{{const member 'i' will never be initialized}} expected-note {{implicitly deleted}}
virtual void f() { }
};