| 1 |
// Testcase for mangling of unnamed types. |
| 2 |
|
| 3 |
// namespace-scope unnamed types have no linkage, so we only test that they |
| 4 |
// are distinct. |
| 5 |
|
| 6 |
// { dg-do compile { target c++11 } } |
| 7 |
// { dg-additional-options -fabi-compat-version=0 } |
| 8 |
|
| 9 |
typedef struct { } *A; |
| 10 |
typedef struct { } *B; |
| 11 |
|
| 12 |
void f(A) { } |
| 13 |
void f(B) { } |
| 14 |
|
| 15 |
struct C |
| 16 |
{ |
| 17 |
typedef struct { }* D; |
| 18 |
typedef enum { e }* E; |
| 19 |
}; |
| 20 |
|
| 21 |
// { dg-final { scan-assembler "_Z2g1PN1CUt_E" } } |
| 22 |
void g1(C::D) { } |
| 23 |
// { dg-final { scan-assembler "_Z2g2PN1CUt0_E" } } |
| 24 |
void g2(C::E) { } |
| 25 |
|
| 26 |
template <class T> |
| 27 |
void h1(T t) { } |
| 28 |
|
| 29 |
template <class T> |
| 30 |
void h2(T t) { } |
| 31 |
|
| 32 |
inline void j() |
| 33 |
{ |
| 34 |
typedef enum { f }* F; |
| 35 |
// { dg-final { scan-assembler "_Z2h1IPZ1jvEUt_EvT_" } } |
| 36 |
h1(F()); |
| 37 |
typedef struct { }* G; |
| 38 |
// { dg-final { scan-assembler "_Z2h2IPZ1jvEUt0_EvT_" } } |
| 39 |
h2(G()); |
| 40 |
} |
| 41 |
|
| 42 |
int main() |
| 43 |
{ |
| 44 |
j(); |
| 45 |
} |