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]

Template bug


I have attached a file that produces an internal compiler error when I try
to compile it.  This really isn't an inconvenience for me, but I thought
I'd send this to you FYI: 

[theron@zippy theron]$ uname -a
Linux zippy 2.0.33 #5 Wed Apr 22 23:41:30 PDT 1998 i586 unknown

[theron@zippy theron]$ g++ -v 
Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.90.27/specs
gcc version egcs-2.90.27 980315 (egcs-1.0.2 release)

[theron@zippy theron]$ g++ goober.cc 
goober.cc:20: Internal compiler error.
goober.cc:20: Please submit a full bug report to `egcs-bugs@cygnus.com'.

If you need any further information, please email me at
theron@cs.ucsb.edu.  Hope this helps you out. 

-Theron

#include <iostream>

class foo 
{
public:
  int x;
};

// The next line causes an error.  Although the ansi standard
// does not allow me to enforce that the template parameter
// be a class that is a subclass of foo, I tried it on a whim.
//
// Compiling produces the following output:
//
// $ g++ goober.cc
// goober.cc:20: Internal compiler error.
// goober.cc:20: Please submit a full bug report to `egcs-bugs@cygnus.com'.
// $ _ 
//
template <class T : public foo>
class bar
{
public:
  foo y;
  bar() { y = new T; }
};

class baz : public foo
{
  baz() :x(3) {}
};

main()
{
  bar<baz> boom;
  cout << boom.y.x << newl;
}




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