summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/tc1/dr49.C
blob: 753d96b6977174804e3f2ea0caa1bf5256cfb23e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// { dg-do compile }
// Contributed by: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
// DR 49: Non-constant pointers are invalid template arguments.

template<int *a> struct R { /* ... */ };
template<int b[5]> struct S { /* ... */ };

int p;
template struct R<&p>; // OK
template struct S<&p>; // OK due to parameter adjustment

int *ptr;
template struct R<ptr>; // { dg-error "argument" }
template struct S<ptr>; // { dg-error "argument" }

int v[5];
template struct R<v>; // OK due to implicit argument conversion
template struct S<v>; // OK due to both adjustment and conversion