]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - test/SemaCXX/destructor.cpp
Update clang to 97654.
[FreeBSD/FreeBSD.git] / test / SemaCXX / destructor.cpp
1 // RUN: %clang_cc1 -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 any parameters}}   \
22     // expected-error{{destructor cannot be variadic}}
23 };
24
25 struct D2 {
26   void ~D2() { } //                          \
27   // expected-error{{destructor cannot have a return type}}  
28 };
29
30
31 struct E;
32
33 typedef E E_typedef;
34 struct E {
35   ~E_typedef(); // expected-error{{destructor cannot be declared using a typedef 'E_typedef' (aka 'struct E') of the class name}}
36 };
37
38 struct F {
39   (~F)(); // expected-note {{previous declaration is here}}
40   ~F(); // expected-error {{destructor cannot be redeclared}}
41 };
42
43 ~; // expected-error {{expected a class name after '~' to name a destructor}}
44 ~undef(); // expected-error {{expected the class name after '~' to name a destructor}}
45 ~operator+(int, int);  // expected-error {{expected a class name after '~' to name a destructor}}
46 ~F(){} // expected-error {{destructor must be a non-static member function}}
47
48 struct G {
49   ~G();
50 };
51
52 G::~G() { }
53
54 // <rdar://problem/6841210>
55 struct H {
56   ~H(void) { } 
57 };
58
59 struct X {};
60
61 struct Y {
62   ~X(); // expected-error {{expected the class name after '~' to name the enclosing class}}
63 };
64
65 namespace PR6421 {
66   class T; // expected-note{{forward declaration}}
67
68   class QGenericArgument
69   {
70     template<typename U>
71     void foo(T t) // expected-error{{variable has incomplete type}}
72     { }
73     
74     void disconnect()
75     {
76       T* t;
77       bob<QGenericArgument>(t); // expected-error{{undeclared identifier 'bob'}}
78     }
79   };
80 }