| 1 |
// PR c++/38647 |
| 2 |
|
| 3 |
template<const char *, int> struct A {}; |
| 4 |
const char func[] = "abc"; |
| 5 |
template<int N> struct A<func, N> {}; // { dg-error "cannot appear|is invalid|not a valid|constant expression" "" { target c++98_only } } |
| 6 |
|
| 7 |
char a1[1]; |
| 8 |
A<a1, 0> a; |
| 9 |
|
| 10 |
template<const char *, int> struct B {}; |
| 11 |
template<int N> struct B<__FUNCTION__, N> {}; // { dg-error "cannot appear|is invalid|is not a valid|constant expression" } |
| 12 |
|
| 13 |
char b1[1]; |
| 14 |
B<b1, 0> b; |
| 15 |
|
| 16 |
template<const char *, int> struct C {}; |
| 17 |
template<int N> struct C<__PRETTY_FUNCTION__, N> {}; // { dg-error "cannot appear|is invalid|is not a valid|constant expression" } |
| 18 |
|
| 19 |
char c1[1]; |
| 20 |
C<c1, 0> c; |
| 21 |
|
| 22 |
template<const char *, int> struct D {}; |
| 23 |
template<int N> struct D<__func__, N> {}; // { dg-error "cannot appear|is invalid|is not a valid|function scope|constant expression" } |
| 24 |
|
| 25 |
char d1[1]; |
| 26 |
D<d1, 0> d; |