This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Template static member bug
- To: nathan at cs dot bris dot ac dot uk
- Subject: Re: Template static member bug
- From: Oskar Enoksson <osken393 at student dot liu dot se>
- Date: Wed, 3 Feb 1999 15:34:07 +0100 (MET)
- cc: egcs-bugs at cygnus dot com
Nathan Sidwell <nathan@acm.org> wrote:
>the 19990131 snapshot (2.93.04) on sparc has no such unresolved symbol.
>When I add a definition of main(), I get,
I get the same result on alphaev56-dec-osf4.0d (egcs-2.93.03) if I include
a main():
template<int N>
class A {
public:
static const char * classname;
};
template<int N>
const char * A<N>::classname="Foo";
int main() {
return A<3>::classname==0;
}
/scratch/local/bin/c++ bar.cpp
/usr/bin/ld:
Unresolved:
A<3>::classname
collect2: ld returned 1 exit status
or with verbose:
> c++ -v bar.cpp | & less
Reading specs from
/scratch/local/lib/gcc-lib/alphaev56-dec-osf4.0d/egcs-2.93.03/specs
gcc version egcs-2.93.03 19990124 (gcc2 ss-980609 experimental)
/scratch/local/lib/gcc-lib/alphaev56-dec-osf4.0d/egcs-2.93.03/cpp
-lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus
-D__GNUC_MINOR__=93 -Dunix -D__os f__ -D_LONGLONG -DSYSTYPE_BSD
-D_SYSTYPE_BSD -D__unix__ -D__osf__ -D_LONGLONG -D__SYSTYPE_BSD__
-D_SYSTYPE_BSD -D__unix -D__SYSTYPE_BSD -Asystem(unix) -Asystem(xpg4)
-D__EXCEPTIONS -D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C -Acpu(alpha)
-Amachine(alpha) -D__alpha -D__alpha__ -D__alpha_ev5__ -Acpu(ev5)
-D__alpha_bwx__ -Acpu(bwx) bar.cpp /tmp/ccNVHoyd.ii GNU CPP version
egcs-2.93.03 19990124 (gcc2 ss-980609 experimental) #include "..." search
starts here: #include <...> search starts here:
/scratch/local/include/g++-2 /scratch/local/include
/scratch/local/lib/gcc-lib/alphaev56-dec-osf4.0d/egcs-2.93.03/../../../../alpha
ev56-dec-osf4.0d/include
/scratch/local/lib/gcc-lib/alphaev56-dec-osf4.0d/egcs-2.93.03/include
/usr/include
End of search list.
/scratch/local/lib/gcc-lib/alphaev56-dec-osf4.0d/egcs-2.93.03/cc1plus
/tmp/ccNV
Hoyd.ii -quiet -dumpbase bar.cc -version -o /tmp/ccwqNtMh.s
GNU C++ version egcs-2.93.03 19990124 (gcc2 ss-980609 experimental)
(alphaev56-dec-osf4.0d) compiled by GNU C version egcs-2.93.03 19990124
(gcc2 ss-980609 experimental).
as -g -nocpp -O0 -o /tmp/ccvhmOKo.o /tmp/ccwqNtMh.s
/scratch/local/lib/gcc-lib/alphaev56-dec-osf4.0d/egcs-2.93.03/mips-tfile
-v -o /tmp/ccvhmOKo.o /tmp/ccwqNtMh.s mips-tfile version egcs-2.93.03
19990124 (gcc2 ss-980609 experimental)
/scratch/local/lib/gcc-lib/alphaev56-dec-osf4.0d/egcs-2.93.03/collect2 -G
8 -O1 -call_shared /usr/lib/cmplrs/cc/crt0.o
-L/scratch/local/lib/gcc-lib/alphaev56-dec-osf4.0d/egcs-2.93.03
-L/usr/lib/cmplrs/cc -L/scratch/local/lib/tmp/ccvhmOKo.o -lstdc++ -lm
-lgcc -lc -lgcc
/usr/bin/ld:
Unresolved:
A<3>::classname
collect2: ld returned 1 exit status
*/ Oskar Enoksson, Linkoping, Sweden /*