| 1 |
// PR c++/44587 |
| 2 |
// { dg-do run } |
| 3 |
|
| 4 |
template <const char *N> struct A { static const char *p; }; |
| 5 |
template <const char *N> const char *A<N>::p = N; |
| 6 |
template <class T> struct B { static const char c[1]; typedef A<B<T>::c> C; }; |
| 7 |
template <class T> const char B<T>::c[1] = ""; |
| 8 |
template <class T> struct D { static const char c[1]; typedef A<c> C; }; |
| 9 |
template <class T> const char D<T>::c[1] = ""; |
| 10 |
|
| 11 |
template <int& I> struct E { static int *ip; }; |
| 12 |
template <int& I> int* E<I>::ip = &I; |
| 13 |
template <class T> struct F { static int i; typedef E<F<T>::i> C; }; |
| 14 |
template <class T> int F<T>::i; |
| 15 |
template <class T> struct G { static int i; typedef E<i> C; }; |
| 16 |
template <class T> int G<T>::i; |
| 17 |
|
| 18 |
#define AS(X) if (!(X)) return 1; |
| 19 |
int main() |
| 20 |
{ |
| 21 |
AS(B<int>::C::p == B<int>::c); |
| 22 |
AS(B<float>::C::p == B<float>::c); |
| 23 |
AS(B<float>::C::p != B<int>::c); |
| 24 |
AS(D<int>::C::p == D<int>::c); |
| 25 |
AS(D<float>::C::p == D<float>::c); |
| 26 |
AS(D<float>::C::p != D<int>::c); |
| 27 |
} |