[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#227518: g++-3.3: Doesn't find inherited inner class after template instantiation



Package: g++-3.3
Version: 1:3.3.2-4
Severity: normal

Compiling the following file using

    g++ -Wall -c test.cc

gives the following errors:

test.cc: In member function `void D::fun()':
test.cc:32: error: parse error before `;' token


# 1 "test.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.cc"
template<typename T>
class A
{
    public:
        typedef int X;
    public:
        A(int i, const int y = 0);
};

class B
{
    public:
        B(const A<int> &z = 1);
};

class C
{
    public:
        class X
        {
            public:
                X() {}
        };
};

class D : public C
{
    public:
        void fun()
        {
            new B();
            new X();
        }
};


If D::fun() is changed into:

        X fun()
        {
            new B();
            return X();
        }

I get:

test.cc: In member function `C::X D::fun()':
test.cc:32: error: `X' undeclared (first use this function)
test.cc:32: error: (Each undeclared identifier is reported only once for each 
   function it appears in.)

The code above is the shortest showing this error I could come up with.

Regards,
Alexander Motzkau   

-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux laptop.motzkau 2.6.1 #1 Fri Jan 9 20:42:43 CET 2004 i686
Locale: LANG=de_DE@euro, LC_CTYPE=de_DE@euro (ignored: LC_ALL set to de_DE@euro)

Versions of packages g++-3.3 depends on:
ii  gcc-3.3                     1:3.3.2-4    The GNU C compiler
ii  gcc-3.3-base                1:3.3.2-4    The GNU Compiler Collection (base 
ii  libc6                       2.3.2.ds1-10 GNU C Library: Shared libraries an
ii  libstdc++5-3.3-dev          1:3.3.2-4    The GNU Standard C++ Library v3 (d

-- no debconf information




Reply to: