diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/tc1/dr49.C')
-rw-r--r-- | gcc/testsuite/g++.dg/tc1/dr49.C | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/tc1/dr49.C b/gcc/testsuite/g++.dg/tc1/dr49.C new file mode 100644 index 0000000..f880e2a --- /dev/null +++ b/gcc/testsuite/g++.dg/tc1/dr49.C @@ -0,0 +1,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 "constant" } +template struct S<ptr>; // { dg-error "constant" } + +int v[5]; +template struct R<v>; // OK due to implicit argument conversion +template struct S<v>; // OK due to both adjustment and conversion + |