EGCS 1.1b bug: template specialisation of static data members

Lassi A. Tuura lat@iki.fi
Mon Nov 23 06:54:00 GMT 1998


Hi,

EGCS 1.1b (on Linux RH5.1 at least) does not seem to differentiate
between declarations and definitions template specialisations of
class-static data members ([temp.expl.spec] 14.7.3/14 in Dec '96 draft). 

Example `bug.cxx':
----
struct X;
template <class T> struct Y { static const X array[]; };
template <> const X Y<int>::array [];
struct X {};
template <> const X Y<int>::array [] = { 0, 1, 2, 3 };
----
Reading specs from /usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.57/specs
gcc version egcs-2.91.57 19980901 (egcs-1.1 release)
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.57/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -D__GNUC_MINOR__=91 -D__ELF__ -Dunix -Dlinux -D__ELF__ -D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Asystem
(unix) -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di686 -Dpentiumpro -D__i686 -D__i686__ -D__pentiumpro -D__pentiumpro__ /tmp/bug.cxx /tmp/ccqHGXQS.ii
GNU CPP version egcs-2.91.57 19980901 (egcs-1.1 release) (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include/g++
 /usr/local/include
 /usr/local/i686-pc-linux-gnu/include
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.57/include
 /usr/include
End of search list.
 /usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.91.57/cc1plus /tmp/ccqHGXQS.ii -quiet -dumpbase bug.cc -version -o /tmp/cceo3l6C.s
GNU C++ version egcs-2.91.57 19980901 (egcs-1.1 release) (i686-pc-linux-gnu) compiled by GNU C version egcs-2.91.57 19980901 (egcs-1.1 release).
/tmp/bug.cxx:5: redefinition of `const struct X const Y<int>::array[]'
/tmp/bug.cxx:3: `const struct X const Y<int>::array[]' previously declared here
/tmp/bug.cxx:5: non-empty initializer for array of empty elements
----

For some other code of mine I also get the following error before any of
the above (`interfaces' is the array):
  /afs/cern.ch/user/l/lat/public/work/src/Control/Net/Net/Module.h:27: 
  array size missing in `ComponentTraits<Module>::interfaces'

Cheers,
//lat
--
With sufficient thrust, pigs fly just fine.  However, this is not
necessarily a good idea.  It is hard to be sure where they are going
to land, and it could be dangerous sitting under them as they fly
overhead.  --RFC1925, "The Twelve Networking Truths"




More information about the Gcc-bugs mailing list