blob: 2134f4ec5c757d78280122736e4cd5ed1f7e7eb2 [file] [log] [blame]
Douglas Gregor42a552f2008-11-05 20:51:48 +00001// RUN: clang -fsyntax-only -verify %s
2class A {
3public:
4 ~A();
5};
6
7class B {
8public:
9 ~B() { }
10};
11
12class C {
13public:
14 (~C)() { }
15};
16
17struct 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
26struct E;
27
28typedef E E_typedef;
29struct E {
30 ~E_typedef(); // expected-error{{destructor cannot be declared using a typedef 'E_typedef' of the class name}}
31};
32
33struct F {
Chris Lattner5f4a6822008-11-23 23:12:31 +000034 (~F)(); // expected-note {{previous declaration is here}}
35 ~F(); // expected-error {{destructor cannot be redeclared}}
Douglas Gregor42a552f2008-11-05 20:51:48 +000036};
37
Argyrios Kyrtzidisc7ed9c62008-11-07 22:02:30 +000038~; // expected-error {{expected class name}}
39~undef(); // expected-error {{expected class name}}
40~F(){} // expected-error {{destructor must be a non-static member function}}
Douglas Gregor9d350972008-12-12 08:25:50 +000041
42struct G {
43 ~G();
44};
45
46G::~G() { }
47