Bug 24326 - bad diagnostic
Summary: bad diagnostic
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.4.0
: P2 normal
Target Milestone: 4.2.0
Assignee: Gabriel Dos Reis
URL:
Keywords: diagnostic
Depends on:
Blocks:
 
Reported: 2005-10-12 08:57 UTC by Ivan Godard
Modified: 2005-12-12 20:08 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-11-24 02:42:55


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Godard 2005-10-12 08:57:49 UTC
template<typename T> struct foo{};
void bar() { enum X{a,b,c}; foo<X> f; };


gets you:


foo.cc: In function `void bar()':
foo.cc:2: error: `bar()::X' uses local type `bar()::X'
foo.cc:2: error:   trying to instantiate `template<class T> struct foo'
foo.cc:2: error: invalid type in declaration before ';' token
Comment 1 Andrew Pinski 2005-10-12 11:37:08 UTC
What is wrong with this? "bar()::X" or something else?  How would you improve it?
Comment 2 Ivan Godard 2005-10-12 19:23:32 UTC
Well, how about:
foo.cc: In function `void bar()':
foo.cc:2: error: template argument `T' uses local type `bar()::X'
foo.cc:2: error:   trying to instantiate `template<class T> struct foo'
foo.cc:2: error: invalid type in declaration before ';' token

IMO, saying "`bar()::X' uses local type `bar()::X'" makes no sense.
Comment 3 Gabriel Dos Reis 2005-11-24 02:42:55 UTC
(In reply to comment #2)

> IMO, saying "`bar()::X' uses local type `bar()::X'" makes no sense.

Agreed.  Working a patch.

Comment 4 Gabriel Dos Reis 2005-11-24 03:39:09 UTC
Fixed on mainline