g++: template instantiation failure on m68k-cbm-netbsd1.3

Ingolf Koch ingolf@maus.rz.uni-jena.de
Thu Apr 2 11:28:00 GMT 1998


Hi,

on my m68k-cbm-netbsd1.3 machine, EGCS-G++ fails to compile
the piece of code below when using -frepo. I cvs updated
980401 at about 9pm GMT.

% cat test.cc
#include <iostream.h>
#include <vector>

template<class T> ostream& operator<<(ostream& ostr, const vector<T>& vec);
int main();


template<class T> ostream&
operator<<(ostream& ostr, const vector<T>& vec) {
//  do something useful here
    return ostr;
}


int
main() {
    vector<int> test(20);

    cout << test << endl;
    return 0;
}


% eg++ -v -frepo -c test.cc -o test.o
Reading specs from /home/ingolf/lib/gcc-lib/m68k-cbm-netbsd1.3/
    egcs-2.91.16/specs
gcc version egcs-2.91.16 980328 (gcc-2.8.0 release)
 /home/ingolf/lib/gcc-lib/m68k-cbm-netbsd1.3/egcs-2.91.16/cpp
    -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus
    -D__GNUC_MINOR__=91 -Dunix -Dm68k -Dmc68000 -Dmc68020
    -D__NetBSD__ -D__unix__ -D__m68k__ -D__mc68000__ -D__mc68020__
    -D__NetBSD__ -D__unix -D__m68k -D__mc68000 -D__mc68020
    -Asystem(unix) -Asystem(NetBSD) -Acpu(m68k) -Amachine(m68k)
    -D__EXCEPTIONS -D__HAVE_68881__ -D__HAVE_FPU__
    test.cc /var/tmp/cc24226a.ii
GNU CPP version egcs-2.91.16 980328 (gcc-2.8.0 release) (68k, MIT syntax)
#include "..." search starts here:
#include <...> search starts here:
 /home/ingolf/include/g++
 /usr/local/include
 /home/ingolf/m68k-cbm-netbsd1.3/include
 /home/ingolf/lib/gcc-lib/m68k-cbm-netbsd1.3/egcs-2.91.16/include
 /usr/include
End of search list.
 /home/ingolf/lib/gcc-lib/m68k-cbm-netbsd1.3/egcs-2.91.16/cc1plus
    /var/tmp/cc24226a.ii -quiet -dumpbase test.cc -version -frepo
    -o /var/tmp/cc24226a.s
GNU C++ version egcs-2.91.16 980328 (gcc-2.8.0 release)
    (m68k-cbm-netbsd1.3) compiled by GNU C version egcs-2.91.16 980328
    (gcc-2.8.0 release).
 as -o test.o /var/tmp/cc24226a.s


% eg++ -v -frepo -o test test.o
Reading specs from /home/ingolf/lib/gcc-lib/m68k-cbm-netbsd1.3/i
    egcs-2.91.16/specs
gcc version egcs-2.91.16 980328 (gcc-2.8.0 release)
 /home/ingolf/lib/gcc-lib/m68k-cbm-netbsd1.3/egcs-2.91.16/ld
    -e start -dc -dp -o test /usr/lib/crt0.o
    -L/home/ingolf/lib/gcc-lib/m68k-cbm-netbsd1.3/egcs-2.91.16
    -L/home/ingolf/m68k-cbm-netbsd1.3/lib -L/home/ingolf/lib
    test.o -lstdc++ -lm -lgcc -lc -lgcc
test.o(.text+0x66): undefined reference to
    `ostream & _ls<int>(ostream &,
        vector<int, __default_alloc_template<0, 0> > const &)'
test.o(.text+0x316): undefined reference to
    `int * fill_n<int *, unsigned int, int>(int *, unsigned int, int const &)'
collect2: ld returned 1 exit status


% as -v
GNU assembler version 2.8.1 (m68k-cbm-netbsd1.3), using BFD version 2.8.1

% ld -v
GNU ld version 2.8.1 (with BFD 2.8.1)

Regards
    Ingolf
-- 

Ingolf Koch         http://www.minet.uni-jena.de/~ingolf/
FSU Jena, Institut fuer Angewandte Mathematik, 07740 Jena



More information about the Gcc-bugs mailing list