| 1 |
// PR target/81325 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "-O2 -fcompare-debug" } |
| 4 |
|
| 5 |
struct A { A(const char *, const int & = 0); }; |
| 6 |
template <typename> struct B; |
| 7 |
template <typename> struct C { |
| 8 |
int _M_i; |
| 9 |
void m_fn1() { __atomic_fetch_add(&_M_i, 0, __ATOMIC_RELAXED); } |
| 10 |
}; |
| 11 |
struct D { |
| 12 |
int *Data; |
| 13 |
long Length = 0; |
| 14 |
D(int) : Data() {} |
| 15 |
}; |
| 16 |
template <> struct B<int> : C<int> {}; |
| 17 |
struct F { |
| 18 |
B<int> RefCount; |
| 19 |
void m_fn2() { RefCount.m_fn1(); } |
| 20 |
}; |
| 21 |
struct G { |
| 22 |
F *Obj; |
| 23 |
G(const G &p1) : Obj(p1.Obj) { |
| 24 |
if (Obj) { |
| 25 |
F *a = 0; |
| 26 |
a->m_fn2(); |
| 27 |
} |
| 28 |
} |
| 29 |
}; |
| 30 |
struct H { |
| 31 |
int CPlusPlus : 1; |
| 32 |
}; |
| 33 |
struct I { |
| 34 |
enum {} KindId; |
| 35 |
}; |
| 36 |
template <typename ResultT, typename ArgT> struct J { |
| 37 |
void operator()(); |
| 38 |
ResultT operator()(ArgT) { return ResultT(); } |
| 39 |
}; |
| 40 |
struct K { |
| 41 |
int AllowBind; |
| 42 |
I SupportedKind; |
| 43 |
I RestrictKind; |
| 44 |
G Implementation; |
| 45 |
}; |
| 46 |
struct L { |
| 47 |
L(int) : Implementation(Implementation) {} |
| 48 |
K Implementation; |
| 49 |
}; |
| 50 |
struct M { |
| 51 |
int Param1; |
| 52 |
}; |
| 53 |
struct N { |
| 54 |
N(int, L &p2) : Param2(p2) {} |
| 55 |
L Param2; |
| 56 |
}; |
| 57 |
struct O { |
| 58 |
L m_fn3(); |
| 59 |
}; |
| 60 |
L ignoringImpCasts(L); |
| 61 |
J<O, L> b; |
| 62 |
L hasName(const A &); |
| 63 |
M hasOverloadedOperatorName(D); |
| 64 |
J<O, int> c; |
| 65 |
struct P { |
| 66 |
void m_fn4(L, int); |
| 67 |
}; |
| 68 |
struct Q { |
| 69 |
void m_fn5(P *); |
| 70 |
}; |
| 71 |
H d; |
| 72 |
void Q::m_fn5(P *p1) { |
| 73 |
if (!d.CPlusPlus) { |
| 74 |
c(); |
| 75 |
L e = 0, f = ignoringImpCasts(e); |
| 76 |
b(ignoringImpCasts(f)).m_fn3(); |
| 77 |
} |
| 78 |
hasOverloadedOperatorName(0); |
| 79 |
hasName(""); |
| 80 |
L g = 0; |
| 81 |
N(0, g); |
| 82 |
L h(0); |
| 83 |
p1->m_fn4(h, 0); |
| 84 |
} |