summaryrefslogtreecommitdiffstats
path: root/clang/test/CXX/expr/expr.unary/expr.delete
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
commitfa7781384ebb16dabc6d60a5ea9a1a8dcfc850a2 (patch)
treec2c7f10c85ad801694969410d1343c2b380d3a88 /clang/test/CXX/expr/expr.unary/expr.delete
parent1732850158f30aa929f90dc88d49c98042b273b3 (diff)
downloadbcm5719-llvm-fa7781384ebb16dabc6d60a5ea9a1a8dcfc850a2.tar.gz
bcm5719-llvm-fa7781384ebb16dabc6d60a5ea9a1a8dcfc850a2.zip
Implement access checking for the "delete" operator. Fixes PR9050,
from Alex Miller! llvm-svn: 124663
Diffstat (limited to 'clang/test/CXX/expr/expr.unary/expr.delete')
-rw-r--r--clang/test/CXX/expr/expr.unary/expr.delete/p5.cpp22
1 files changed, 17 insertions, 5 deletions
diff --git a/clang/test/CXX/expr/expr.unary/expr.delete/p5.cpp b/clang/test/CXX/expr/expr.unary/expr.delete/p5.cpp
index 2fa30e59dca..ecb29189af6 100644
--- a/clang/test/CXX/expr/expr.unary/expr.delete/p5.cpp
+++ b/clang/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}}
+};
OpenPOWER on IntegriCloud