Internal compiler error with partial specialisation of templates
Martin Berger
martinb@dcs.qmw.ac.uk
Wed Oct 4 05:04:00 GMT 2000
hello, the following program, which i accidentally compiled
is not liked by g++ -- martin
#include <iostream>
class ZeroDim
{
public:
ZeroDim() : dimension_( 0 ) {};
void printDimension(){ cout << "dimension_ = " << dimension_ << endl; };
protected:
int dimension_;
};
template <template <int n> class Base>
class PointImpl : public Base<n>
{
public:
PointImpl() : Base<n>(), coordinate_( 0 ) { ++dimension_; };
protected:
int coordinate_;
};
template <int n>
class Point
{};
template<>
class Point<0> : public ZeroDim
{};
template <>
template <int n>
class Point<n+1> : public PointImpl< Point<n> >
{};
int main( int, char** )
{
Point<0> p0;
Point<1> p1;
p0.printDimension();
p1.printDimension();
}
here is g++'s output:
kohei-pc> gcc -v --save-temps parametr.cpp
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs
gcc version 2.95.2 20000220 (Debian GNU/Linux)
/usr/lib/gcc-lib/i386-linux/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus
-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__ parametr.cpp parametr.ii
GNU CPP version 2.95.2 20000220 (Debian GNU/Linux) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc-lib/i386-linux/2.95.2/../../../../include/g++-3
/usr/local/include
/usr/lib/gcc-lib/i386-linux/2.95.2/include
/usr/include
End of search list.
The following default directories have been omitted from the search path:
/usr/lib/gcc-lib/i386-linux/2.95.2/../../../../i386-linux/include
End of omitted list.
/usr/lib/gcc-lib/i386-linux/2.95.2/cc1plus parametr.ii -quiet -dumpbase parametr.cc -version -o parametr.s
GNU C++ version 2.95.2 20000220 (Debian GNU/Linux) (i386-linux) compiled by GNU C version 2.95.2 20000220 (Debian
GNU/Linux).
parametr.cpp: In method `PointImpl<Base>::PointImpl()':
parametr.cpp:21: Internal compiler error.
parametr.cpp:21: Please submit a full bug report.
parametr.cpp:21: See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.
kohei-pc>
i have attached the gzipped .ii file.
parametr.ii.gz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: parametr.ii.gz
Type: application/x-gzip
Size: 6273 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20001004/dc806391/attachment.bin>
More information about the Gcc-bugs
mailing list