Home | History | Annotate | Download | only in SemaCXX
      1 // RUN: %clang_cc1 -triple i686-mingw32 -ast-dump %s | FileCheck %s
      2 
      3 template<class T>
      4 class P {
      5  public:
      6   P(T* t) {}
      7 };
      8 
      9 namespace foo {
     10 class A { public: A(int = 0) {} };
     11 enum B {};
     12 typedef int C;
     13 }
     14 
     15 // CHECK: VarDecl {{0x[0-9a-fA-F]+}} <line:16:1, col:36> col:15 ImplicitConstrArray 'foo::A [2]'
     16 static foo::A ImplicitConstrArray[2];
     17 
     18 int main() {
     19   // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::A *'
     20   P<foo::A> p14 = new foo::A;
     21   // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::B *'
     22   P<foo::B> p24 = new foo::B;
     23   // CHECK: CXXNewExpr {{0x[0-9a-fA-F]+}} <col:19, col:28> 'foo::C *'
     24   P<foo::C> pr4 = new foo::C;
     25 }
     26 
     27 foo::A getName() {
     28   // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:10, col:17> 'foo::A'
     29   return foo::A();
     30 }
     31 
     32 void destruct(foo::A *a1, foo::A *a2, P<int> *p1) {
     33   // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:8> '<bound member function type>' ->~A
     34   a1->~A();
     35   // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:16> '<bound member function type>' ->~A
     36   a2->foo::A::~A();
     37   // CHECK: MemberExpr {{0x[0-9a-fA-F]+}} <col:3, col:13> '<bound member function type>' ->~P
     38   p1->~P<int>();
     39 }
     40 
     41 struct D {
     42   D(int);
     43   ~D();
     44 };
     45 
     46 void construct() {
     47   using namespace foo;
     48   A a = A(12);
     49   // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'class foo::A' 'void (int){{( __attribute__\(\(thiscall\)\))?}}'
     50   D d = D(12);
     51   // CHECK: CXXConstructExpr {{0x[0-9a-fA-F]+}} <col:9, col:13> 'struct D' 'void (int){{( __attribute__\(\(thiscall\)\))?}}'
     52 }
     53