[Bug c++/27347] New: static array member specialization failure
maxim dot yegorushkin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Apr 28 10:15:00 GMT 2006
$ cat exp.cpp
template<class T> struct type_name { static char const name[]; };
template<class T> char const type_name<T>::name[] = "";
template<> char const type_name<int>::name[] = "int";
$ g++ -v exp.cpp
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,java,f95,ada --enable-java-awt=gtk
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--host=x86_64-redhat-linux
Thread model: posix
gcc version 4.0.2 20051125 (Red Hat 4.0.2-8)
/usr/libexec/gcc/x86_64-redhat-linux/4.0.2/cc1plus -quiet -v -D_GNU_SOURCE
exp.cpp -quiet -dumpbase exp.cpp -mtune=k8 -auxbase exp -version -o
/tmp/ccC0PGNG.s
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../x86_64-redhat-linux/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2
/usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/x86_64-redhat-linux
/usr/lib/gcc/x86_64-redhat-linux/4.0.2/../../../../include/c++/4.0.2/backward
/usr/local/include
/usr/lib/gcc/x86_64-redhat-linux/4.0.2/include
/usr/include
End of search list.
GNU C++ version 4.0.2 20051125 (Red Hat 4.0.2-8) (x86_64-redhat-linux)
compiled by GNU C version 4.0.2 20051125 (Red Hat 4.0.2-8).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
exp.cpp:3: error: initializer-string for array of chars is too long
Comeau online compiles the code just fine. If the sizeof of the initializer at
line 2 is at least as big as sizeof("int") then it compiles fine with g++.
The error is reproducible with g++ 4.0.2 and 4.1.0.
--
Summary: static array member specialization failure
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: maxim dot yegorushkin at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27347
More information about the Gcc-bugs
mailing list