diff options
author | Douglas Gregor <dgregor@apple.com> | 2008-11-05 20:51:48 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2008-11-05 20:51:48 +0000 |
commit | 831c93f6c08b0111e9a185058e67cdc3e88bd1ab (patch) | |
tree | 15d851fc529d8540e479c0f4137bae713f43aa6d /clang/test/SemaCXX/destructor.cpp | |
parent | b4ebbc5a865ba4b0dc6094d32f9f8731a0790658 (diff) | |
download | bcm5719-llvm-831c93f6c08b0111e9a185058e67cdc3e88bd1ab.tar.gz bcm5719-llvm-831c93f6c08b0111e9a185058e67cdc3e88bd1ab.zip |
Parsing, representation, and preliminary semantic analysis of destructors.
Implicit declaration of destructors (when necessary).
Extended Declarator to store information about parsed constructors
and destructors; this will be extended to deal with declarators that
name overloaded operators (e.g., "operator +") and user-defined
conversion operators (e.g., "operator int").
llvm-svn: 58767
Diffstat (limited to 'clang/test/SemaCXX/destructor.cpp')
-rw-r--r-- | clang/test/SemaCXX/destructor.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/destructor.cpp b/clang/test/SemaCXX/destructor.cpp new file mode 100644 index 00000000000..1eec0d5f007 --- /dev/null +++ b/clang/test/SemaCXX/destructor.cpp @@ -0,0 +1,37 @@ +// RUN: clang -fsyntax-only -verify %s +class A { +public: + ~A(); +}; + +class B { +public: + ~B() { } +}; + +class C { +public: + (~C)() { } +}; + +struct D { + static void ~D(int, ...) const { } // \ + // expected-error{{type qualifier is not allowed on this function}} \ + // expected-error{{destructor cannot be declared 'static'}} \ + // expected-error{{destructor cannot have a return type}} \ + // expected-error{{destructor cannot have any parameters}} \ + // expected-error{{destructor cannot be variadic}} +}; + +struct E; + +typedef E E_typedef; +struct E { + ~E_typedef(); // expected-error{{destructor cannot be declared using a typedef 'E_typedef' of the class name}} +}; + +struct F { + (~F)(); // expected-error{{previous declaration is here}} + ~F(); // expected-error{{destructor cannot be redeclared}} +}; + |