Anders Carlsson | 2cf738f | 2009-08-26 19:22:42 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
| 2 | struct A {}; |
| 3 | |
| 4 | enum Foo { F }; |
| 5 | typedef Foo Bar; |
| 6 | |
Douglas Gregor | a71d819 | 2009-09-04 17:36:40 +0000 | [diff] [blame] | 7 | typedef int Integer; |
| 8 | |
| 9 | void g(); |
| 10 | |
| 11 | namespace N { |
| 12 | typedef Foo Wibble; |
| 13 | } |
| 14 | |
| 15 | void f(A* a, Foo *f, int *i) { |
Anders Carlsson | 2cf738f | 2009-08-26 19:22:42 +0000 | [diff] [blame] | 16 | a->~A(); |
| 17 | a->A::~A(); |
| 18 | |
| 19 | a->~foo(); // expected-error{{identifier 'foo' in pseudo-destructor expression does not name a type}} |
Douglas Gregor | a71d819 | 2009-09-04 17:36:40 +0000 | [diff] [blame] | 20 | |
| 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 Carlsson | 2cf738f | 2009-08-26 19:22:42 +0000 | [diff] [blame] | 34 | } |
Douglas Gregor | a78c5c3 | 2009-09-04 18:29:40 +0000 | [diff] [blame] | 35 | |
| 36 | typedef int Integer; |
| 37 | |
| 38 | void destroy_without_call(int *ip) { |
| 39 | ip->~Integer; // expected-error{{called immediately}} |
Daniel Dunbar | 4fcfde4 | 2009-11-08 01:45:36 +0000 | [diff] [blame] | 40 | } |
Douglas Gregor | f6e6fc8 | 2009-11-20 22:03:38 +0000 | [diff] [blame^] | 41 | |
| 42 | // PR5530 |
| 43 | namespace N1 { |
| 44 | class X0 { }; |
| 45 | } |
| 46 | |
| 47 | void test_X0(N1::X0 &x0) { |
| 48 | x0.~X0(); |
| 49 | } |