| 1 |
// PR debug/109676 |
| 2 |
// { dg-do compile { target c++11 } } |
| 3 |
// { dg-options "-O2 -g -march=alderlake" } |
| 4 |
|
| 5 |
template <class T> |
| 6 |
struct A { |
| 7 |
T a; |
| 8 |
char b; |
| 9 |
template <typename U> |
| 10 |
A (U x, int) : a{x} {} |
| 11 |
A (...); |
| 12 |
T foo () { return a; } |
| 13 |
}; |
| 14 |
bool bar (); |
| 15 |
struct B { int c, d; unsigned char e[8]; }; |
| 16 |
bool baz (); |
| 17 |
struct C { C () : f () {} B &boo () { return f; } B f; }; |
| 18 |
|
| 19 |
A<B> |
| 20 |
qux () |
| 21 |
{ |
| 22 |
{ |
| 23 |
A<B> p; |
| 24 |
bool t = true; |
| 25 |
for (; bar ();) |
| 26 |
if (baz ()) |
| 27 |
{ |
| 28 |
t = false; |
| 29 |
break; |
| 30 |
} |
| 31 |
if (t) |
| 32 |
p.b = false; |
| 33 |
return p; |
| 34 |
} |
| 35 |
} |
| 36 |
|
| 37 |
A<C> |
| 38 |
garply () |
| 39 |
{ |
| 40 |
C g; |
| 41 |
A<B> h = qux (); |
| 42 |
if (!h.b) |
| 43 |
return 0; |
| 44 |
g.boo () = h.foo (); |
| 45 |
return A<C>{g, 0}; |
| 46 |
} |