OSDN Git Service

Pizza-lize :-)
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.dg / tc1 / dr49.C
1 // { dg-do compile }
2 // Contributed by: Giovanni Bajo <giovannibajo at gcc dot gnu dot org>
3 // DR 49: Non-constant pointers are invalid template arguments.
4
5 template<int *a> struct R { /* ... */ };
6 template<int b[5]> struct S { /* ... */ };
7
8 int p;
9 template struct R<&p>; // OK
10 template struct S<&p>; // OK due to parameter adjustment
11
12 int *ptr;
13 template struct R<ptr>; // { dg-error "argument" }
14 template struct S<ptr>; // { dg-error "argument" }
15
16 int v[5];
17 template struct R<v>; // OK due to implicit argument conversion
18 template struct S<v>; // OK due to both adjustment and conversion
19