diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-07-13 17:21:42 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-07-13 17:21:42 +0000 |
commit | 4ba675006b5a8edfc48b6a9bd3dcf54a70cc08f2 (patch) | |
tree | 48b44512b5db8ced345df4a1a56b5065cf2a14d9 /test/SemaCXX/destructor.cpp | |
parent | d7279c4c177bca357ef96ff1379fd9bc420bfe83 (diff) |
Diffstat (limited to 'test/SemaCXX/destructor.cpp')
-rw-r--r-- | test/SemaCXX/destructor.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/test/SemaCXX/destructor.cpp b/test/SemaCXX/destructor.cpp index ae3dc86e97f5..4f6c76bc90ed 100644 --- a/test/SemaCXX/destructor.cpp +++ b/test/SemaCXX/destructor.cpp @@ -19,7 +19,9 @@ struct D { // expected-error{{type qualifier is not allowed on this function}} \ // expected-error{{destructor cannot be declared 'static'}} \ // expected-error{{destructor cannot have any parameters}} \ - // expected-error{{destructor cannot be variadic}} + // expected-error{{destructor cannot be variadic}} \ + // expected-error{{destructor cannot have a return type}} \ + // expected-error{{'const' qualifier is not allowed on a destructor}} }; struct D2 { @@ -83,3 +85,23 @@ namespace PR6709 { template<class T> class X { T v; ~X() { ++*v; } }; void a(X<int> x) {} } + +struct X0 { virtual ~X0() throw(); }; +struct X1 : public X0 { }; + +// Make sure we instantiate operator deletes when building a virtual +// destructor. +namespace test6 { + template <class T> class A { + public: + void *operator new(__SIZE_TYPE__); + void operator delete(void *p) { + T::deleteIt(p); // expected-error {{type 'int' cannot be used prior to '::'}} + } + + virtual ~A() {} // expected-note {{in instantiation of member function 'test6::A<int>::operator delete' requested here}} + }; + + class B : A<int> { B(); }; + B::B() {} +} |