• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-apple-darwin10 | FileCheck %s
2 
3 struct S {
~SS4   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 
f()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 
f2()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 
f3()25 int f3() { return f2(); }
26 
27 struct A {
28   typedef struct { int x; } *ptr;
29   ptr m;
aA30   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 
f4()39 int f4() { return A().a(); }
40 
f5()41 int f5() {
42   static union {
43     int a;
44   };
45 
46   // CHECK: _ZZ2f5vE1a
47   return a;
48 }
49 
f6()50 int f6() {
51   static union {
52     union {
53       int : 1;
54     };
55     int b;
56   };
57 
58   // CHECK: _ZZ2f6vE1b
59   return b;
60 }
61 
f7()62 int f7() {
63   static union {
64     union {
65       int b;
66     } a;
67   };
68 
69   // CHECK: _ZZ2f7vE1a
70   return a.b;
71 }
72 
73 // This used to cause an assert because the typedef-for-anonymous-tag
74 // code was trying to claim the enum for the template.
75 enum { T8 };
76 template <class T> struct Test8 {
77   typedef T type;
Test8Test878   Test8(type t) {} // tested later
79 };
make_test8(T value)80 template <class T> void make_test8(T value) { Test8<T> t(value); }
test8()81 void test8() { make_test8(T8); }
82 
83 // CHECK-LABEL: define internal void @"_ZNV3$_35test9Ev"(
84 typedef volatile struct {
test9__anon39860d2e0b0885   void test9() volatile {}
86 } Test9;
test9()87 void test9() {
88   Test9 a;
89   a.test9();
90 }
91 
92 // CHECK-LABEL: define internal void @"_ZN5Test8I3$_2EC1ES0_"(
93