aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/flexarray-subst.C
blob: f6446366165415008dbe9054c3c78e5d4cb98167 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// PR c++/69251 - [6 Regression] ICE (segmentation fault) in unify_array_domain
// on i686-linux-gnu
// { dg-do compile }

struct A { int n; char a[]; };

template <class>
struct B;

// The following definition shouldn't be needed but is provided to prevent
// the test from failing with an error due to PR c++/69349 - template
// substitution error for flexible array members.  (This doesn't compromise
// the validity of this test since all it tests for is the absennce of
// the ICE.)
template <class>
struct B { typedef int X; };

template <class T>
struct B<T[]> { typedef int X; };

template <class T>
struct C { typedef typename B<T>::X X; };

template <class T>
int foo (T&, typename C<T>::X = 0)
{
  return 0;
}

void bar (A *a)
{
  foo (a->a);
}