1 // RUN: %clang_cc1 -triple %ms_abi_triple -ast-print %s -std=gnu++11 | FileCheck %s
4 // CHECK-NEXT: (r->method());
13 MyClass
* operator ->() { return object
; }
21 // CHECK: if (int a = 1)
22 // CHECK: while (int a = 1)
23 // CHECK: switch (int a = 1)
24 // CHECK: for (; int a = 1;)
30 switch (int a
= 1) { }
31 for(; int a
= 1; ) { }
34 // CHECK: new (1) int;
35 void *operator new (typeof(sizeof(1)), int, int = 2);
42 void *operator new (typeof(sizeof(1)), int = 2);
44 void test4() { new X
; }
46 // CHECK: for (int i = 2097, j = 42; false;)
48 for (int i
= 2097, j
= 42; false;) {}
51 // CHECK: test6fn((int &)y);
60 template <class S
> void test7()
68 template <typename T
> void test8(T t
) { t
.~T(); }
76 // CHECK-NEXT: {{^[ ]+}}E a = A;
99 // CHECK-NEXT: return test10::M::X<INT>::value;
101 return test10::M::X
<INT
>::value
;
105 struct DefaultArgClass
107 DefaultArgClass(int a
= 1) {}
108 DefaultArgClass(int a
, int b
, int c
= 1) {}
116 struct VirualDestrClass
118 VirualDestrClass(int arg
);
119 virtual ~VirualDestrClass();
122 struct ConstrWithCleanupsClass
124 ConstrWithCleanupsClass(const VirualDestrClass
& cplx
= VirualDestrClass(42));
128 // CHECK-NEXT: DefaultArgClass useDefaultArg;
129 // CHECK-NEXT: DefaultArgClass overrideDefaultArg(1);
130 // CHECK-NEXT: DefaultArgClass(1, 2);
131 // CHECK-NEXT: DefaultArgClass(1, 2, 3);
132 // CHECK-NEXT: NoArgClass noArg;
133 // CHECK-NEXT: ConstrWithCleanupsClass cwcNoArg;
134 // CHECK-NEXT: ConstrWithCleanupsClass cwcOverrideArg(48);
135 // CHECK-NEXT: ConstrWithCleanupsClass cwcExplicitArg(VirualDestrClass(56));
137 DefaultArgClass useDefaultArg
;
138 DefaultArgClass
overrideDefaultArg(1);
139 DefaultArgClass tempWithDefaultArg
= DefaultArgClass(1, 2);
140 DefaultArgClass tempWithExplictArg
= DefaultArgClass(1, 2, 3);
142 ConstrWithCleanupsClass cwcNoArg
;
143 ConstrWithCleanupsClass
cwcOverrideArg(48);
144 ConstrWithCleanupsClass
cwcExplicitArg(VirualDestrClass(56));
147 // CHECK: void test13() {
148 // CHECK: _Atomic(int) i;
149 // CHECK: __c11_atomic_init(&i, 0);
150 // CHECK: __c11_atomic_load(&i, 0);
154 __c11_atomic_init(&i
, 0);
155 __c11_atomic_load(&i
, 0);
159 // CHECK: void test14() {
167 struct X
{ union { int x
; } x
; };
171 // CHECK: float test15() {
172 // CHECK: return __builtin_asinf(1.F);
174 // CHECK-NOT: extern "C"
176 return __builtin_asinf(1.0F
);
182 explicit operator bool();
187 // CHECK-NEXT: {{^[ ]*operator}} void *();
188 // CHECK-NEXT: {{^[ ]*explicit}} operator bool();
195 // CHECK: bar(a & b);
206 // CHECK: {{\[\[clang::fallthrough\]\]}}
207 [[clang::fallthrough
]];
215 // CHECK: struct {{\[\[gnu::visibility\(\"hidden\"\)\]\]}} S;
216 struct [[gnu::visibility("hidden")]] S
;
219 // CHECK: struct CXXFunctionalCastExprPrint {
220 // CHECK-NEXT: } fce = CXXFunctionalCastExprPrint{};
221 struct CXXFunctionalCastExprPrint
{} fce
= CXXFunctionalCastExprPrint
{};
223 // CHECK: struct CXXTemporaryObjectExprPrint {
224 // CHECK-NEXT: CXXTemporaryObjectExprPrint();
225 // CHECK-NEXT: } toe = CXXTemporaryObjectExprPrint{};
226 struct CXXTemporaryObjectExprPrint
{ CXXTemporaryObjectExprPrint(); } toe
= CXXTemporaryObjectExprPrint
{};
229 // CHECK: template <typename T> struct Foo : T {
230 // CHECK: using T::operator-;
231 template <typename T
> struct Foo
: T
{
236 namespace dont_crash_on_auto_vars
{
237 struct T
{ enum E
{X
= 12ll }; };
239 struct { int I
; } ADecl
;
240 static const auto Y
= T::X
;
242 //CHECK: static const auto Y = T::X;
243 constexpr auto var
= T::X
;
244 //CHECK: constexpr auto var = T::X;