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]
Other format: [Raw text]

[Bug c++/24791] New: ICE on invalid instantiation of template's static member


tracked down sample is:

$ cat xx.cc

template < int I >
struct A
{
        int get_val() const;

        static int val_;
};

template< int I >
int A<I>::get_val() const
{
        return val_;
}

template< int I >    // this is invalid: works with "template <>"
int A<0>::val_(0);

// must instantiate to get ICE
template class A<0>;


$ g++ -v
Reading specs from
/tools/snapshot/toolsbox-3.5.1.4pre.20051110/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/specs
Configured with:
/tools/snapshot/src/sapc154/toolsbox-3.5.1.4pre.20051110/buildroot/gcc/gcc-3.4.4/configure
--with-gnu-as --with-gnu-ld --enable-threads=posix
--with-as=/tools/snapshot/toolsbox-3.5.1.4pre.20051110//i686-pc-linux-gnu/bin/as
--with-ld=/tools/snapshot/toolsbox-3.5.1.4pre.20051110//i686-pc-linux-gnu/bin/ld
--with-local-prefix=/tools/snapshot/toolsbox-3.5.1.4pre.20051110/ --disable-nls
--prefix=/tools/snapshot/toolsbox-3.5.1.4pre.20051110/
Thread model: posix
gcc version 3.4.4

$ g++ -v -c xx.cc
Reading specs from
/tools/snapshot/toolsbox-3.5.1.4pre.20051110/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/specs
Configured with:
/tools/snapshot/src/sapc154/toolsbox-3.5.1.4pre.20051110/buildroot/gcc/gcc-3.4.4/configure
--with-gnu-as --with-gnu-ld --enable-threads=posix
--with-as=/tools/snapshot/toolsbox-3.5.1.4pre.20051110//i686-pc-linux-gnu/bin/as
--with-ld=/tools/snapshot/toolsbox-3.5.1.4pre.20051110//i686-pc-linux-gnu/bin/ld
--with-local-prefix=/tools/snapshot/toolsbox-3.5.1.4pre.20051110/ --disable-nls
--prefix=/tools/snapshot/toolsbox-3.5.1.4pre.20051110/
Thread model: posix
gcc version 3.4.4

/tools/snapshot/toolsbox-3.5.1.4pre.20051110/bin/../libexec/gcc/i686-pc-linux-gnu/3.4.4/cc1plus
-quiet -v -iprefix
/tools/snapshot/toolsbox-3.5.1.4pre.20051110/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/
-D_GNU_SOURCE xx.cc -quiet -dumpbase xx.cc -mtune=pentiumpro -auxbase xx
-version -o /tmp/ccuQDWYE.s
ignoring nonexistent directory
"/tools/snapshot/toolsbox-3.5.1.4pre.20051110/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../i686-pc-linux-gnu/include"
ignoring duplicate directory
"/tools/snapshot/toolsbox-3.5.1.4pre.20051110//lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../include/c++/3.4.4"
ignoring duplicate directory
"/tools/snapshot/toolsbox-3.5.1.4pre.20051110//lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../include/c++/3.4.4/i686-pc-linux-gnu"
ignoring duplicate directory
"/tools/snapshot/toolsbox-3.5.1.4pre.20051110//lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../include/c++/3.4.4/backward"
ignoring duplicate directory
"/tools/snapshot/toolsbox-3.5.1.4pre.20051110//lib/gcc/i686-pc-linux-gnu/3.4.4/include"
ignoring nonexistent directory
"/tools/snapshot/toolsbox-3.5.1.4pre.20051110//lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/tools/snapshot/toolsbox-3.5.1.4pre.20051110/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../include/c++/3.4.4

/tools/snapshot/toolsbox-3.5.1.4pre.20051110/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../include/c++/3.4.4/i686-pc-linux-gnu

/tools/snapshot/toolsbox-3.5.1.4pre.20051110/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/../../../../include/c++/3.4.4/backward

/tools/snapshot/toolsbox-3.5.1.4pre.20051110/bin/../lib/gcc/i686-pc-linux-gnu/3.4.4/include
 /tools/snapshot/toolsbox-3.5.1.4pre.20051110//include
 /usr/include
End of search list.
GNU C++ version 3.4.4 (i686-pc-linux-gnu)
        compiled by GNU C version 3.4.4.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
xx.cc:18: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


-- 
           Summary: ICE on invalid instantiation of template's static member
           Product: gcc
           Version: 3.4.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: michael dot haubenwallner at salomon dot at
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24791


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