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++/29054] New: ICE on friend template specialization


The following program:

struct A {
    template <typename T, typename U>
    static A create(U) {}
};

namespace N {
  class B {
      B() {}
      friend A A::create<B, const char*>(const char*);
  };
}

int main()
{
    A a;
    a.create<N::B>("test");
}

compiled as follows:

g++ -v -c test.cpp

produces an ICE:

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /var/tmp/portage/gcc-4.1.1/work/gcc-4.1.1/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.1.1
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--disable-nls --with-system-zlib --disable-checking --disable-werror
--disable-libunwind-exceptions --disable-multilib --disable-libmudflap
--disable-libssp --disable-libgcj --enable-languages=c,c++ --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
Thread model: posix
gcc version 4.1.1 (Gentoo 4.1.1)
 /usr/libexec/gcc/i686-pc-linux-gnu/4.1.1/cc1plus -quiet -v -D_GNU_SOURCE
test.cpp -quiet -dumpbase test.cpp -mtune=pentiumpro -auxbase test -version -o
/tmp/ccCmgFxT.s
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4
 /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/i686-pc-linux-gnu
 /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4/backward
 /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include
 /usr/include
End of search list.
GNU C++ version 4.1.1 (Gentoo 4.1.1) (i686-pc-linux-gnu)
        compiled by GNU C version 4.1.1 (Gentoo 4.1.1).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: ea9667438f8bc79493837ce647b4862c
test.cpp: In static member function 'static A A::create(U) [with T = N::B, U =
const char*]':
test.cpp:16:   instantiated from here
test.cpp:9: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugs.gentoo.org/> for instructions.
Preprocessed source stored into /tmp/ccA9Qsu8.out file, please attach this to
your bugreport.

Best regards,

Tom


-- 
           Summary: ICE on friend template specialization
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: Thomas8675309 at yahoo dot com


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


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