gcc/testsuite/g++.dg/parse/template25.C
raw| 1 | // PR c++/22318. Improve diagnostic for local template declaration. |
| 2 | // { dg-do compile } |
| 3 | void f(void) |
| 4 | { |
| 5 | template<typename T> class A /* { dg-error "a template declaration cannot appear at block scope" } */ |
| 6 | { |
| 7 | }; |
| 8 | } |
| 9 | |
| 10 | void g(void) |
| 11 | { |
| 12 | template f<int>(); /* { dg-error "expected primary-expression" "primary-expression" } */ |
| 13 | } |