[Bug c++/47957] [4.3/4.4/4.5/4.6 Regression] Type mismatch when a class derived a same name with template parameter

dodji at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Mar 7 16:26:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47957

Dodji Seketeli <dodji at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
         AssignedTo|unassigned at gcc dot       |dodji at gcc dot gnu.org
                   |gnu.org                     |

--- Comment #5 from Dodji Seketeli <dodji at gcc dot gnu.org> 2011-03-07 16:26:23 UTC ---
Here is a testcase that does away with #include <iostream> and
#include <typeid> requirements:

struct S
{
  int m;

  S()
    : m(0)
  {
  }
};

struct Base
{
  typedef S T;
};

template<class T>
struct Derived : public Base
{
  int
  foo()
  {
    T a; // This is Base::T, not the template parameter.
    return a.m;
  }
};

int
main()
{
  Derived<char> d;
  return d.foo();
}



More information about the Gcc-bugs mailing list