| 1 |
// P0846R0 |
| 2 |
// { dg-do compile } |
| 3 |
// { dg-options "-std=c++2a" } |
| 4 |
|
| 5 |
const unsigned long arr[10] = { 2 }; |
| 6 |
template<class T> struct S { int n; }; |
| 7 |
|
| 8 |
template <class T> |
| 9 |
int fn1 (S<T>* s) |
| 10 |
{ |
| 11 |
int i = 1; |
| 12 |
return s->n < arr[i + 1]; |
| 13 |
} |
| 14 |
|
| 15 |
template <class T> |
| 16 |
int fn2 (S<T> s) |
| 17 |
{ |
| 18 |
int i = 1; |
| 19 |
return s.n < arr[i + 1]; |
| 20 |
} |
| 21 |
|
| 22 |
template <class T> |
| 23 |
int fn3 (S<T>* s) |
| 24 |
{ |
| 25 |
int i = 1; |
| 26 |
return s->template n < 1; // { dg-error "parse error in template argument list" } |
| 27 |
} |
| 28 |
|
| 29 |
template <class T> |
| 30 |
int fn4 (S<T> s) |
| 31 |
{ |
| 32 |
int i = 1; |
| 33 |
return s.template n < 1; // { dg-error "parse error in template argument list" } |
| 34 |
} |