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]

gcc-2.95: internal compiler error with nested template


The problem: internal compiler error involving a nested template class.
The example is heavily cut down from the original and therefore makes
little sense, but it still provokes the error.

Command line:

.../lib/gcc-lib/i386-pc-solaris2.6/2.95/cc1plus y.ii -version -o y.s

My machine:

> uname -a
SunOS wombat 5.6 Generic i86pc i386 i86pc

Output:

GNU C++ version 2.95 19990728 (release) (i386-pc-solaris2.6) compiled by GNU C version 2.95 19990728 (release).
options passed:
options enabled:  -fpeephole -ffunction-cse -fkeep-static-consts
 -fpcc-struct-return -fexceptions -fcommon -fgnu-linker -fargument-alias
 -fident -m80387 -mhard-float -mno-soft-float -mieee-fp -mfp-ret-in-387
 -mschedule-prologue -mcpu=i386 -march=pentium
 Foo::Foo(int = 0) struct Foo & Foo::operator =(const Foo &) struct Foo & Foo::operator =(int) int Foo::Bar<int>::operator =(int)
y.ii: In method `int Foo::Bar<int>::operator =(int)':
y.ii:7:   instantiated from here
y.ii:14: Internal compiler error.
y.ii:14: Please submit a full bug report.
y.ii:14: See <URL:http://egcs.cygnus.com/faq.html#bugreport> for instructions.

Contents of y.ii:

struct Foo
{
        template <class T> struct Bar;

        Foo (int rhs=0)                   {}
        Foo & operator = (const Foo& rhs) { return *this; }
        Foo & operator = (int rhs)        { this->bar() = rhs; return *this; }
        Bar <int> bar ()                  { return Bar <int> (); }

private:
        template <class T> struct Bar
        {
                Bar () {}
                T operator = (const T rhs) { return rhs; }
        };
};


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