This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Template declaration inside function
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: Mattias Karlsson <betasoft at acc dot umu dot se>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 21 Jun 2005 18:44:21 +0200
- Subject: Re: Template declaration inside function
- References: <Pine.GSO.4.62.0506211824120.25845@shaka.acc.umu.se>
* 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.