| 1 |
// PR c++/69251 - [6 Regression] ICE (segmentation fault) in unify_array_domain |
| 2 |
// on i686-linux-gnu |
| 3 |
// { dg-do compile } |
| 4 |
// { dg-additional-options "-Wno-error=pedantic" } |
| 5 |
|
| 6 |
struct A { |
| 7 |
int n; |
| 8 |
char a[]; // { dg-warning "8:ISO C\\+\\+ forbids flexible array member" } |
| 9 |
}; |
| 10 |
|
| 11 |
template <class> |
| 12 |
struct B; |
| 13 |
|
| 14 |
// The following definition shouldn't be needed but is provided to prevent |
| 15 |
// the test from failing with an error due to PR c++/69349 - template |
| 16 |
// substitution error for flexible array members. (This doesn't compromise |
| 17 |
// the validity of this test since all it tests for is the absennce of |
| 18 |
// the ICE.) |
| 19 |
template <class> |
| 20 |
struct B { typedef int X; }; |
| 21 |
|
| 22 |
template <class T> |
| 23 |
struct B<T[]> { typedef int X; }; |
| 24 |
|
| 25 |
template <class T> |
| 26 |
struct C { typedef typename B<T>::X X; }; |
| 27 |
|
| 28 |
template <class T> |
| 29 |
int foo (T&, typename C<T>::X = 0) |
| 30 |
{ |
| 31 |
return 0; |
| 32 |
} |
| 33 |
|
| 34 |
void bar (A *a) |
| 35 |
{ |
| 36 |
foo (a->a); |
| 37 |
} |