Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm-only -verify %s |
Eli Friedman | 6f9f25d | 2009-12-11 20:21:38 +0000 | [diff] [blame] | 2 | |
| 3 | struct S { |
| 4 | virtual ~S() { } |
| 5 | }; |
| 6 | |
| 7 | // PR5706 |
| 8 | // Make sure this doesn't crash; the mangling doesn't matter because the name |
| 9 | // doesn't have linkage. |
| 10 | static struct : S { } obj8; |
| 11 | |
| 12 | void f() { |
| 13 | // Make sure this doesn't crash; the mangling doesn't matter because the |
| 14 | // generated vtable/etc. aren't modifiable (although it would be nice for |
| 15 | // codesize to make it consistent inside inline functions). |
| 16 | static struct : S { } obj8; |
| 17 | } |
| 18 | |
| 19 | inline int f2() { |
| 20 | // FIXME: We don't mangle the names of a or x correctly! |
| 21 | static struct { int a() { static int x; return ++x; } } obj; |
| 22 | return obj.a(); |
| 23 | } |
| 24 | |
| 25 | int f3() { return f2(); } |
| 26 | |
| 27 | struct A { |
| 28 | typedef struct { int x; } *ptr; |
| 29 | ptr m; |
| 30 | int a() { |
| 31 | static struct x { |
| 32 | // FIXME: We don't mangle the names of a or x correctly! |
| 33 | int a(ptr A::*memp) { static int x; return ++x; } |
| 34 | } a; |
| 35 | return a.a(&A::m); |
| 36 | } |
| 37 | }; |
| 38 | |
| 39 | int f4() { return A().a(); } |