summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/pseudo-destructors.cpp
blob: f1fa331aa2434a98a79de79ecdde5e2ba3eb35b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// RUN: clang-cc -fsyntax-only -verify %s
struct A {};

enum Foo { F };
typedef Foo Bar;

typedef int Integer;

void g();

namespace N {
  typedef Foo Wibble;
}

void f(A* a, Foo *f, int *i) {
  a->~A();
  a->A::~A();
  
  a->~foo(); // expected-error{{identifier 'foo' in pseudo-destructor expression does not name a type}}
  
  // FIXME: the type printed below isn't wonderful
  a->~Bar(); // expected-error{{no member named}}
  
  f->~Bar();
  f->~Foo();
  i->~Bar(); // expected-error{{does not match}}
  
  g().~Bar(); // expected-error{{non-scalar}}
  
  f->::~Bar();
  f->N::~Wibble();
  
  f->::~Bar(17, 42); // expected-error{{cannot have any arguments}}
}
OpenPOWER on IntegriCloud