If we have two template classes in hierarchy and try to take type of the
topmost class, gcc shows error message while VC 8.0 and Comeau C/C++ 4.3.3 does
not.

The following exapmle shows code that generates the error:

template <typename T>
class A
{
public:
  typedef int TType;

private:
  typedef T tmp;
};

template <typename T>
class B : public A<T>
{
public:
  typedef char* TType;

private:
  typedef T tmp;
};

template <typename T>
class Test
{
public:
  static void test()
  {
    typename B<T>::A::TType a = 0;
    typename B<T>::TType b = "test";
  }
};


int main(int argc, char* argv[])
{
  Test<int>::test();
}

Error message is following:
test.cpp: In static member function `static void Test<T>:
:test() [with T = int]':
test.cpp:35:   instantiated from here
test.cpp:27: error: no type named `A' in `class B<int>'


-- 
           Summary: Type resolving for template class hierarchy
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: 4ekucT at tut dot by


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

Reply via email to