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]

Template bug


Compiling the following program gives me an assembler-error (error-ouput
below). If I omit the marked line everything compiles fine.

==========testit.cc=====================================================

template<unsigned long SIZE>
struct Array { };

template<unsigned long SIZE>
Array<SIZE> test_ok(const Array<SIZE>& a) {
    Array<SIZE> result;
    return(result);
}

template<unsigned long SIZE>
Array<SIZE + 1> test_error(const Array<SIZE>& a) {
    Array<SIZE + 1> result;
    return(result);
}

int main(int argc, char* argv[]) {
    Array<2> a;

    test_ok(a);
    test_error(a); // <<< MARKED LINE!

    return(0);
}

========================================================================

[wotan] /tmp $ egcs-g++ -v -Wall testit.cc -o testit
Reading specs from
/u/kostab/packages/egcs-1.0/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.21/specs
gcc version egcs-2.90.21 971202 (egcs-1.00 release)

/u/kostab/packages/egcs-1.0/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.21/cpp
-lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus
-D__GNUC_MINOR__=90 -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) testit.cc /tmp/cca002Rp.ii
GNU CPP version egcs-2.90.21 971202 (egcs-1.00 release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /u/kostab/packages/egcs-1.0/include/g++
 /usr/local/include
 /u/kostab/packages/egcs-1.0/sparc-sun-solaris2.5.1/include

/u/kostab/packages/egcs-1.0/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.21/include
 /usr/include
End of search list.

/u/kostab/packages/egcs-1.0/lib/gcc-lib/sparc-sun-solaris2.5.1/egcs-2.90.21/cc1plus
/tmp/cca002Rp.ii -quiet -dumpbase testit.cc -Wall -version -o
/tmp/cca002Rp.s
GNU C++ version egcs-2.90.21 971202 (egcs-1.00 release)
(sparc-sun-solaris2.5.1) compiled by GNU C version egcs-2.90.21 971202
(egcs-1.00 release).
 /usr/ccs/bin/as -V -Qy -s -o /tmp/cca002Rp1.o /tmp/cca002Rp.s
/usr/ccs/bin/as: SC4.2 dev 30 Nov 1995
/usr/ccs/bin/as: "/tmp/cca002Rp.s", line 72: error: invalid operand
/usr/ccs/bin/as: "/tmp/cca002Rp.s", line 73: error: statement syntax
/usr/ccs/bin/as: "/tmp/cca002Rp.s", line 75: error: unknown opcode
"test_error__H1Ul2_RCt5Array1UlY01_t5Array1Ul"
/usr/ccs/bin/as: "/tmp/cca002Rp.s", line 75: error: statement syntax
/usr/ccs/bin/as: "/tmp/cca002Rp.s", line 93: error: statement syntax
/usr/ccs/bin/as: "/tmp/cca002Rp.s", line 31: error: expression must
evaluate to a nonrelocatable (absolute) value

-- 
Konstantin Baumann                   Westfaelische Wilhelms-Universitaet 
Institut fuer Informatik (Zi. 603),  Einsteinstr. 62,   D-48149 Muenster
mailto:kostab@math.uni-muenster.de                  Tel:+49-251-83-32701
http://wwwmath.uni-muenster.de/cs/u/kostab/         Fax:+49-251-83-33755


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