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]

foo.cc:15: Internal compiler error.


Hi,

I've been playing around with template specialisation, the following
code is likely wrong but in any case it causes an internal compiler error:

Reading specs from
/homes/njs3/pub/gcc/egcs-current/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.29/specs
gcc version egcs-2.91.29 19980517 (gcc2 ss-980502 experimental)
 /homes/njs3/pub/gcc/egcs-current/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.29/cpp
-lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus
-D__GNUC_MINOR__=91 -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4
-D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun
-D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -Wall
-D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) foo.cc
/var/tmp/cca0051s.ii
GNU CPP version egcs-2.91.29 19980517 (gcc2 ss-980502 experimental)
(sparc)
#include "..." search starts here:
#include <...> search starts here:
 /homes/njs3/pub/gcc/egcs-current/include/g++
 /homes/njs3/pub/gcc/egcs-current/sparc-sun-solaris2.5.1/include
 /homes/njs3/pub/gcc/egcs-current/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.29/include
 /usr/include
End of search list.
 /homes/njs3/pub/gcc/egcs-current/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.91.29/cc1plus
/var/tmp/cca0051s.ii -quiet -dumpbase foo.cc -Wall -version -o
/var/tmp/cca0051s.s
GNU C++ version egcs-2.91.29 19980517 (gcc2 ss-980502 experimental)
(sparc-sun-solaris2.5.1) compiled by GNU C version 2.7.2.
foo.cc:15: Internal compiler error.
foo.cc:15: Please submit a full bug report to `egcs-bugs@cygnus.com'.


#include <iostream>

template<class A, class B>
void foo(const A& a, const B& b)
{
	cerr << "generic" << endl;	
}

template<class A, class B>
void foo(const A& a, const int& b)
{
	cerr << "specific (B = int)" << endl;	
}

template<class A*, class B>
void foo(const A*& a, const B& b)
{
	cerr << "specific (A = pointer type)" << endl;
}

template<>
void foo(const int&, const double&)
{
	cerr << "specific (int, double)" << endl;	
}


int
main()
{
	foo("98239", 23);
	foo(232, 1.022);
}


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