aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp1
-rw-r--r--test/CXX/expr/expr.unary/expr.delete/p5.cpp22
-rw-r--r--test/SemaCXX/new-delete.cpp11
3 files changed, 29 insertions, 5 deletions
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
index bb1d67f51a..634369dd52 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p1.cpp
@@ -89,6 +89,7 @@ namespace test2 {
namespace test3 {
class A {
+ public:
~A();
};
diff --git a/test/CXX/expr/expr.unary/expr.delete/p5.cpp b/test/CXX/expr/expr.unary/expr.delete/p5.cpp
index 2fa30e59dc..ecb29189af 100644
--- a/test/CXX/expr/expr.unary/expr.delete/p5.cpp
+++ b/test/CXX/expr/expr.unary/expr.delete/p5.cpp
@@ -24,11 +24,23 @@ void f0(T2_A *a) { T2_C x; x.f0(a); }
class T2_A { };
// An alternate version of the same.
-//
-// FIXME: Revisit this case when we have access control.
class T3_A;
template<typename T>
-struct T3_B { void f0(T *a) { delete a; } };
-struct T3_C { T3_B<T3_A> x; void f0(T3_A *a) { x.f0(a); } };
+struct T3_B {
+ void f0(T *a) {
+ delete a; // expected-error{{calling a private destructor of class 'T3_A'}}
+ }
+};
+
+struct T3_C {
+ T3_B<T3_A> x;
+ void f0(T3_A *a) {
+ x.f0(a); // expected-note{{in instantiation of member function 'T3_B<T3_A>::f0' requested here}}
+ }
+};
+
void f0(T3_A *a) { T3_C x; x.f0(a); }
-class T3_A { private: ~T3_A(); };
+class T3_A {
+private:
+ ~T3_A(); // expected-note{{declared private here}}
+};
diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp
index 19d5df6673..13ef461e7c 100644
--- a/test/SemaCXX/new-delete.cpp
+++ b/test/SemaCXX/new-delete.cpp
@@ -234,6 +234,17 @@ void f(X14 *x14a, X14 *x14b) {
delete x14a;
}
+class X15 {
+private:
+ X15(); // expected-note {{declared private here}}
+ ~X15(); // expected-note {{declared private here}}
+};
+
+void f(X15* x) {
+ new X15(); // expected-error {{calling a private constructor}}
+ delete x; // expected-error {{calling a private destructor}}
+}
+
namespace PR5918 { // Look for template operator new overloads.
struct S { template<typename T> static void* operator new(size_t, T); };
void test() {