blob: 15fdabfe32fa0df663cfed6908560bcc05c31213 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// RUN: %clang_cc1 -ast-print %s | FileCheck %s
// CHECK: r;
// CHECK-NEXT: (r->method());
struct MyClass
{
void method() {}
};
struct Reference
{
MyClass* object;
MyClass* operator ->() { return object; }
};
int main()
{
Reference r;
(r->method());
}
// CHECK: if (int a = 1)
// CHECK: while (int a = 1)
// CHECK: switch (int a = 1)
void f()
{
if (int a = 1) { }
while (int a = 1) { }
switch (int a = 1) { }
}
// CHECK: new (1) int;
void *operator new (typeof(sizeof(1)), int, int = 2);
void f2() {
new (1) int;
}
// CHECK: new X;
struct X {
void *operator new (typeof(sizeof(1)), int = 2);
};
void f2() { new X; }
// CHECK: for (int i = 2097, j = 42; false;)
void forInit() {
for (int i = 2097, j = 42; false;) {}
}
|