Bug 46005 - [C++0x] Don't allow "auto" as the simple-type-specifier of a typedef
Summary: [C++0x] Don't allow "auto" as the simple-type-specifier of a typedef
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: 4.6.1
Assignee: Jason Merrill
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-13 13:40 UTC by Johannes Schaub
Modified: 2011-05-26 13:47 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-05-25 17:04:01


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Schaub 2010-10-13 13:40:57 UTC
The following is ill-formed, but GCC allows it

  typedef auto autot;

And it seems GCC itself can't handle it

  autot t = 0; // variable has incomplete type!?

Neither does the Standard specify how it should be handled (it only talks about auto type specifiers, as opposed to "auto" being the type designated semantically. There is no semantic equivalent for "auto" it seems). In Standard C++, something like "autot t = 0;" can't occur, I think.
Comment 1 Andreas Schwab 2010-10-13 15:12:13 UTC
I'm getting 'error: ‘autot’ does not name a type' with both current trunk and 4.5.  4.4 gives "error: conflicting specifiers in declaration of ‘autot’" which is the better error message (which you get also with trunk and 4.5 with "typedef auto int autot;").
Comment 2 Johannes Schaub 2010-10-13 15:28:04 UTC
(In reply to comment #1)
> I'm getting 'error: ‘autot’ does not name a type' with both current trunk and
> 4.5.  4.4 gives "error: conflicting specifiers in declaration of ‘autot’" which
> is the better error message (which you get also with trunk and 4.5 with
> "typedef auto int autot;").

You haven't enabled C++0x. My PR is about C++0x's "auto".
Comment 3 Andreas Schwab 2010-10-13 15:39:22 UTC
Let's make this explicit.
Comment 4 Jason Merrill 2011-05-26 13:47:32 UTC
Fixed for 4.6.1.