Bug 31730 - nested typedef to template of same name rejected
Summary: nested typedef to template of same name rejected
Status: RESOLVED INVALID
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-04-27 20:13 UTC by Eric Niebler
Modified: 2007-04-27 21:24 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eric Niebler 2007-04-27 20:13:31 UTC
The following code should compile. With gcc 4.3 it does not.

   template<typename Iter> struct match_context { };

   template<typename BidIter>
   struct match_state
   {
     typedef match_context<BidIter> match_context;
   };
Comment 1 Andrew Pinski 2007-04-27 20:16:54 UTC
No, the error message is correct.  You change the meaning of match_context in the class.

Doing:
    typedef ::match_context<BidIter> match_context;

Fixes the source to be valid C++.  Note C++ does not really require a diagnostic here (it is one of the invalid code that C++ does not require one).
Comment 2 Eric Niebler 2007-04-27 21:24:14 UTC
Yep, thanks. According to Doug Gregor, this case is covered in the first para of
[basic.scope.class]. My bad.