public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Template declaration inside function
@ 2005-06-21 16:39 Mattias Karlsson
  2005-06-21 16:44 ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: Mattias Karlsson @ 2005-06-21 16:39 UTC (permalink / raw)
  To: gcc


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?

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Template declaration inside function
  2005-06-21 16:39 Template declaration inside function Mattias Karlsson
@ 2005-06-21 16:44 ` Florian Weimer
  2005-06-21 17:02   ` Mattias Karlsson
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2005-06-21 16:44 UTC (permalink / raw)
  To: Mattias Karlsson; +Cc: gcc

* 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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Template declaration inside function
  2005-06-21 16:44 ` Florian Weimer
@ 2005-06-21 17:02   ` Mattias Karlsson
  0 siblings, 0 replies; 3+ messages in thread
From: Mattias Karlsson @ 2005-06-21 17:02 UTC (permalink / raw)
  To: gcc

On Tue, 21 Jun 2005, Florian Weimer wrote:

> * 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.

This is now enhancement/22138.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-06-21 17:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-21 16:39 Template declaration inside function Mattias Karlsson
2005-06-21 16:44 ` Florian Weimer
2005-06-21 17:02   ` Mattias Karlsson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).