Douglas Gregor | 42a552f | 2008-11-05 20:51:48 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
| 2 | class A { |
| 3 | public: |
| 4 | ~A(); |
| 5 | }; |
| 6 | |
| 7 | class B { |
| 8 | public: |
| 9 | ~B() { } |
| 10 | }; |
| 11 | |
| 12 | class C { |
| 13 | public: |
| 14 | (~C)() { } |
| 15 | }; |
| 16 | |
| 17 | struct D { |
| 18 | static void ~D(int, ...) const { } // \ |
| 19 | // expected-error{{type qualifier is not allowed on this function}} \ |
| 20 | // expected-error{{destructor cannot be declared 'static'}} \ |
| 21 | // expected-error{{destructor cannot have a return type}} \ |
| 22 | // expected-error{{destructor cannot have any parameters}} \ |
| 23 | // expected-error{{destructor cannot be variadic}} |
| 24 | }; |
| 25 | |
| 26 | struct E; |
| 27 | |
| 28 | typedef E E_typedef; |
| 29 | struct E { |
| 30 | ~E_typedef(); // expected-error{{destructor cannot be declared using a typedef 'E_typedef' of the class name}} |
| 31 | }; |
| 32 | |
| 33 | struct F { |
| 34 | (~F)(); // expected-error{{previous declaration is here}} |
| 35 | ~F(); // expected-error{{destructor cannot be redeclared}} |
| 36 | }; |
| 37 | |
Argyrios Kyrtzidis | c7ed9c6 | 2008-11-07 22:02:30 +0000 | [diff] [blame] | 38 | ~; // expected-error {{expected class name}} |
| 39 | ~undef(); // expected-error {{expected class name}} |
| 40 | ~F(){} // expected-error {{destructor must be a non-static member function}} |