mangle-unnamed.cpp revision 6f9f25dfc7bf9cc1ab1282d6d7e9cf7916d8a09c
1// RUN: clang-cc -emit-llvm-only -verify %s
2
3struct 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.
10static struct : S { } obj8;
11
12void 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
19inline 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
25int f3() { return f2(); }
26
27struct 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
39int f4() { return A().a(); }
40