aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/expr/expr.unary/expr.delete/p5.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-02-01 15:50:11 +0000
committerDouglas Gregor <dgregor@apple.com>2011-02-01 15:50:11 +0000
commitd880f52be3e4a8ccad92ac31932eeae5e0870a93 (patch)
tree97af0d083661709907c9ab8374ce6c1d92d877b9 /test/CXX/expr/expr.unary/expr.delete/p5.cpp
parentf9997a0834e0e0298b04ef044ad2699c727a7979 (diff)
Implement access checking for the "delete" operator. Fixes PR9050,
from Alex Miller! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124663 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX/expr/expr.unary/expr.delete/p5.cpp')
-rw-r--r--test/CXX/expr/expr.unary/expr.delete/p5.cpp22
1 files changed, 17 insertions, 5 deletions
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}}
+};