From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10792 invoked by alias); 28 Apr 2006 10:15:16 -0000 Received: (qmail 10731 invoked by uid 48); 28 Apr 2006 10:15:12 -0000 Date: Fri, 28 Apr 2006 10:15:00 -0000 Subject: [Bug c++/27347] New: static array member specialization failure X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "maxim dot yegorushkin at gmail dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-04/txt/msg02478.txt.bz2 List-Id: $ cat exp.cpp template struct type_name { static char const name[]; }; template char const type_name::name[] = ""; template<> char const type_name::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