Bug 10682 - [3.3/3.4 regression] chokes on a typedef for an enum inside a class template
Summary: [3.3/3.4 regression] chokes on a typedef for an enum inside a class template
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3
: P3 normal
Target Milestone: 3.3.1
Assignee: Kriang Lerdsuwanakij
URL:
Keywords: rejects-valid
Depends on:
Blocks:
 
Reported: 2003-05-08 14:46 UTC by meinlschmidt
Modified: 2004-01-17 04:22 UTC (History)
2 users (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 meinlschmidt 2003-05-08 14:46:01 UTC
#ifdef CLUNK
template<typename T>
#endif
class Foo {
public:
  enum xyzzy {a,b,c};
  typedef xyzzy Xyzzy;
};

class Bar {
  void baz(Foo
#ifdef CLUNK
  <int>
#endif
  ::Xyzzy x);  // error: `Xyzzy' is not a member of type `Foo<int>'
};

Release:
gcc (GCC) 3.3 20030226 (prerelease) (SuSE Linux)

Environment:
Intel clone,
Linux, SuSE 8.2 distro out-of-the-box

How-To-Repeat:
gcc -DCLUNK hitTheBug.C
Comment 1 meinlschmidt 2003-05-08 14:46:01 UTC
Fix:
omit -DCLUNK :-)
or use gcc (GCC) 3.2.2
Comment 2 Wolfgang Bangerth 2003-05-08 15:43:03 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed, a regression from 3.2:
    -------------------------------
    template<typename T>
    struct Foo {
      enum E {a,b,c};
      typedef E EE;
    };
    
    void baz(Foo<int>::EE x);
    --------------------------
    
    g/x> /home/bangerth/bin/gcc-3.2.3-pre/bin/c++ -c z.cc
    
    g/x> /home/bangerth/bin/gcc-3.3-pre/bin/c++ -c z.cc
    z.cc:7: error: `EE' is not a member of type `Foo<int>'
    z.cc:7: error: parse error before `)' token
    
    g/x> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c z.cc
    z.cc:7: error: variable or field `baz' declared void
    z.cc:7: error: `EE' is not a member of `struct Foo<int>'
    
    The whole thing works if we do
        typedef int EE;
    instead, so this is really a bug.
    
    W.
Comment 3 Jason Merrill 2003-05-20 17:14:06 UTC
Responsible-Changed-From-To: unassigned->jason
Responsible-Changed-Why: got it
Comment 4 Jason Merrill 2003-05-20 21:20:50 UTC
Responsible-Changed-From-To: jason->lerdsuwa
Responsible-Changed-Why: you broke it
Comment 5 Kriang Lerdsuwanakij 2003-05-23 15:32:22 UTC
Fixed in 3.3 branch and trunk.