| 1 |
// PR middle-end/108854 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "-O3" } |
| 4 |
// { dg-additional-options "-fPIC" { target fpic } } |
| 5 |
|
| 6 |
struct A { A (int); ~A (); }; |
| 7 |
struct B { B (int, bool); ~B (); }; |
| 8 |
template <typename T> |
| 9 |
struct C { void m1 (T); void m2 (T &&); }; |
| 10 |
class D; |
| 11 |
struct E { virtual void m3 (); }; |
| 12 |
template <typename> |
| 13 |
struct F { virtual bool m4 (D &); }; |
| 14 |
struct D { virtual D m5 () { return D (); } }; |
| 15 |
void foo (void *, void *); |
| 16 |
struct G { |
| 17 |
int a; |
| 18 |
C <D *> b; |
| 19 |
void m4 (D &r) { B l (a, true); r.m5 (); b.m1 (&r); b.m2 (&r); } |
| 20 |
}; |
| 21 |
struct H : E, F <int> { |
| 22 |
template <typename T> |
| 23 |
H (int, T); |
| 24 |
bool m4 (D &r) { A l (a); b.m4 (r); if (c) return true; } // { dg-warning "control reaches end of non-void function" } |
| 25 |
int a; |
| 26 |
bool c; |
| 27 |
G b; |
| 28 |
}; |
| 29 |
inline void bar (F <int> &p) { D s, t; p.m4 (t); foo (&p, &s); } |
| 30 |
enum I { I1, I2 }; |
| 31 |
template <I> |
| 32 |
struct J; |
| 33 |
template <class, class T, class, class, class, class> |
| 34 |
void baz () { int g = 0, h = 0; T i (g, h); bar (i); } |
| 35 |
template <class, int, I T> |
| 36 |
void qux () { baz <int, H, int, int, E, J<T>> (); } |
| 37 |
void corge () { qux <int, I2, I1> (); qux <int, I2, I2> (); } |