Bug in template instantiation?

Paul Stodghill stodghil@CS.Cornell.EDU
Wed Oct 28 14:22:00 GMT 1998


I have a small program that compiles with KCC, but not with egcs 1.1b. It
appears that egcs gets confused and uses a "double*" in a place where it
should use a "Scalar<double>*", or vice versa.

r02n09% uname -a
AIX r02n09 2 4 000064808900
r02n09% KCC -v -c code2.C
/afs/theory/system/dest/@sys/local/kaicpp/003/app/KCC/bin/kfront -D__cplusplus -D__CPLUSPLUS -D__STDC__=0 -D_ANSI_C_SOURCE -Dunix -D__KCC -D_AIX -D__unix --kai_optimize 1 --dead_type --inline_keyword_space_time=75 --inline_implicit_space_time=20 --kai_version -I/afs/theory/system/dest/@sys/local/kaicpp/003/app/KCC/include -I/afs/theory/system/dest/@sys/local/kaicpp/003/app/KCC/include/wrapped --gen_c_file_name=/tmp/scratch/code2.31802.stodghil.int.c code2.C
KAI C++ 3.2f (KCC) -- May  8 1998 -- (C) Copyright 1994-1998 Kuck & Associates, Inc.
xlc -qlanglvl=extended -w -O -c /tmp/scratch/code2.31802.stodghil.int.c
mv -f code2.31802.stodghil.int.o code2.o
r02n09% 

ringding% g++ -v --save-temps -c code2.C 
Reading specs from /usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
 /usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.57/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 -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) code2.C code2.ii
GNU CPP version egcs-2.91.57 19980901 (egcs-1.1 release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/gnu/egcs-1.1b/include/g++
 /usr/local/include
 /usr/local/gnu/egcs-1.1b/sparc-sun-solaris2.6/include
 /usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.57/include
 /usr/include
End of search list.
 /usr/local/gnu/egcs-1.1b/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.57/cc1plus code2.ii -quiet -dumpbase code2.cc -version -o code2.s
GNU C++ version egcs-2.91.57 19980901 (egcs-1.1 release) (sparc-sun-solaris2.6) compiled by GNU C version egcs-2.91.57 19980901 (egcs-1.1 release).
code2.C: In method `class list<pair<list<int,__default_alloc_template<false,0> >,double *>,__default_alloc_template<false,0> > Vector<Scalar<double>,double>::all_elements<Scalar<double>, double>()':
code2.C:67:   instantiated from here
code2.C:55: conversion from `__list_iterator<pair<list<int,__default_alloc_template<false,0> >,double *>,pair<list<int,__default_alloc_template<false,0> >,double *> &,pair<list<int,__default_alloc_template<false,0> >,double *> *>' to non-scalar type `__list_iterator<pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *>,pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *> &,pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *> *>' requested
code2.C:55: no match for `__list_iterator<pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *>,pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *> &,pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *> *> & != __list_iterator<pair<list<int,__default_alloc_template<false,0> >,double *>,pair<list<int,__default_alloc_template<false,0> >,double *> &,pair<list<int,__default_alloc_template<false,0> >,double *> *>'
/usr/local/gnu/egcs-1.1b/include/g++/stl_list.h:69: candidates are: __list_iterator<pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *>,pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *> &,pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *> *>::operator !=<pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *>, pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *> &, pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *> *>(const __list_iterator<pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *>,pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *> &,pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *> *> &) const
/usr/local/gnu/egcs-1.1b/include/g++/stl_pair.h: In method `pair<list<int,__default_alloc_template<false,0> >,double *>::pair<list<int,__default_alloc_template<false,0> >, Scalar<double> *>(const struct pair<list<int,__default_alloc_template<false,0> >,Scalar<double> *> &)':
code2.C:58:   instantiated from `Vector<Scalar<double>,double>::all_elements<Scalar<double>, double>()'
code2.C:67:   instantiated from here
/usr/local/gnu/egcs-1.1b/include/g++/stl_pair.h:48: assignment to `double *' from `Scalar<double> *'
ringding%

-------------- next part --------------
A non-text attachment was scrubbed...
Name: code2.ii.gz
Type: application/x-gzip
Size: 17271 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/19981028/94bb0944/attachment.bin>


More information about the Gcc-bugs mailing list