Template declaration inside function
Florian Weimer
fw@deneb.enyo.de
Tue Jun 21 16:44:00 GMT 2005
* Mattias Karlsson:
> Given:
>
> void f(void)
> {
> template<typename T> class A
> {
> };
> }
>
> g++ 4.0/3.4 gives:
> bug.cpp:4: error: expected primary-expression before 'template'
>
> Can a language lawer please confirm that this is even valid before I
> create a PR?
It's not valid (local template declarations are not allowed, see
14(2)), but it makes sense to create a PR. The error message is very
hard to understand.
More information about the Gcc
mailing list