blob: 1f05e81df5306eb046dc109f45ee8d45f4d1bb45 [file] [log] [blame]
Anders Carlsson2cf738f2009-08-26 19:22:42 +00001// RUN: clang-cc -fsyntax-only -verify %s
2struct A {};
3
4enum Foo { F };
5typedef Foo Bar;
6
Douglas Gregora71d8192009-09-04 17:36:40 +00007typedef int Integer;
8
9void g();
10
11namespace N {
12 typedef Foo Wibble;
13}
14
15void f(A* a, Foo *f, int *i) {
Anders Carlsson2cf738f2009-08-26 19:22:42 +000016 a->~A();
17 a->A::~A();
18
19 a->~foo(); // expected-error{{identifier 'foo' in pseudo-destructor expression does not name a type}}
Douglas Gregora71d8192009-09-04 17:36:40 +000020
21 // FIXME: the type printed below isn't wonderful
22 a->~Bar(); // expected-error{{no member named}}
23
24 f->~Bar();
25 f->~Foo();
26 i->~Bar(); // expected-error{{does not match}}
27
28 g().~Bar(); // expected-error{{non-scalar}}
29
30 f->::~Bar();
31 f->N::~Wibble();
32
33 f->::~Bar(17, 42); // expected-error{{cannot have any arguments}}
Anders Carlsson2cf738f2009-08-26 19:22:42 +000034}
Douglas Gregora78c5c32009-09-04 18:29:40 +000035
36typedef int Integer;
37
38void destroy_without_call(int *ip) {
39 ip->~Integer; // expected-error{{called immediately}}
40}