possible template problem

Tero Pulkkinen terop@students.cc.tut.fi
Fri Nov 27 18:27:00 GMT 1998


Here's nice small code that gives internal compiler error. 

note that the example is not supposed to be working code,
It should give (like egcs-2.91.55 does):
no matching function for call to `connect_to_method (Signal1<Gtk_Widget *> &, Gtk_Container *, void (Gtk_Container::*)(Gtk_Widget *))'

But it does give (egcs-2.92.23):
container.cc: In method `Gtk_Container::Gtk_Container()':
container.cc:22: Internal compiler error 981006.

(and it does give the same internal error,even if proper overloaded
version of connect_to_method for Signal1<T> would exists - I just
cut/pasted it away to make the example shorter..)

Hope this helps,
-- 
-- Tero Pulkkinen -- terop@modeemi.cs.tut.fi --


// ---------------- container.cc starts -----------------------
class Signal0 { };

template<class T,class T1>
void connect_to_method(Signal0 &signal,
                       T* receiver,
                       void (T1::*method)() ) { }

template<class P1>
class Signal1 { };

class Gtk_Widget;

class Gtk_Container
{
public:
  Signal1<Gtk_Widget*> remove;
  void remove_callback(Gtk_Widget *p1);
  Gtk_Container();
};

Gtk_Container::Gtk_Container() {
  connect_to_method(remove, this, &remove_callback);
}
// ---------------- container.cc ends -----------------------




% eg++ -v --save-temps container.cc
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.92.23/specs
gcc version egcs-2.92.23 19981127 (gcc2 ss-980609 experimental)
 /usr/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.92.23/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=92 -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ container.cc container.ii
GNU CPP version egcs-2.92.23 19981127 (gcc2 ss-980609 experimental) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/g++-2
 /usr/include
 /usr/i686-pc-linux-gnu/include
 /usr/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.92.23/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.92.23/cc1plus container.ii -quiet -dumpbase container.cc -version -o container.s
GNU C++ version egcs-2.92.23 19981127 (gcc2 ss-980609 experimental) (i686-pc-linux-gnu) compiled by GNU C version egcs-2.91.58 19981101 (egcs-1.1.1 pre-release 2, Debian 2.1).
container.cc: In method `Gtk_Container::Gtk_Container()':
container.cc:22: Internal compiler error 981006.
container.cc:22: Please submit a full bug report to `egcs-bugs@cygnus.com'.
container.cc:22: See <URL: http://egcs.cygnus.com/faq.html#bugreport > for details.





More information about the Gcc-bugs mailing list