| 1 |
// PR debug/103742 |
| 2 |
// { dg-do compile { target c++17 } } |
| 3 |
// { dg-options "-O2 -fnon-call-exceptions --param=early-inlining-insns=82 -fcompare-debug" } |
| 4 |
|
| 5 |
template <typename T> T max(T a, T b) { return a >= b ? a : b; } |
| 6 |
template <typename T> T abs(T); |
| 7 |
template <int T, int U> struct A { |
| 8 |
long a; |
| 9 |
A(A &x) { a = x.a; } |
| 10 |
A(long); |
| 11 |
A foo(A) { |
| 12 |
if (abs(a) && a == a) |
| 13 |
a = a ? U : T; |
| 14 |
else |
| 15 |
a += a; |
| 16 |
return *this; |
| 17 |
} |
| 18 |
bool operator>=(A) { return a; } |
| 19 |
}; |
| 20 |
struct B {}; |
| 21 |
struct C { |
| 22 |
A<2147483647, 0> c; |
| 23 |
}; |
| 24 |
struct D { |
| 25 |
A<2147483647, 0> d; |
| 26 |
C e[]; |
| 27 |
}; |
| 28 |
struct E : D{} * f; |
| 29 |
A<2147483647, 0> bar() { |
| 30 |
A<2147483647, 0> g = g.foo(f->d); |
| 31 |
return max(g, (A<2147483647, 0>)1); |
| 32 |
} |
| 33 |
E *h; |
| 34 |
void baz() { |
| 35 |
h->e[0].c = bar(); |
| 36 |
} |