This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/11546] New: Type lookup problems in out-of-line definition of a class doubly nested from a template class


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Type lookup problems in out-of-line definition of a
                    class doubly nested from a template class
           Product: gcc
           Version: 3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fgccbz0 at greynode dot net
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

The following code does not compile as expected:

template <class T0>
class A {
public:
  class B;
};

template <class T0>
class A<T0>::B {
public:
  class C;
};

template <class T0>
class A<T0>::B::C {
public:
  A<T0> &a;
};

I originally tried with the redhat 9 gcc-3.2, which ICE'd. I then followed up by
downloading and compiling vanilla gcc-3.3 from ftp.gnu.org. With the g++ from
that compile, the above code produces:

Foo.cpp:16: error: non-template type `A' used as a template
Foo.cpp:16: error: ISO C++ forbids declaration of `a' with no type

Since A most definitely is a template, I think this is wrong. I've seen other
weird behaviour with more complex examples, but this seems like a good starting
point.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]