When I try to compile the file bug.cpp with
g++ bug.cpp -o bug
gcc gives the error message

bug.cpp:6: internal compiler error: in uses_template_parms, at cp/pt.c:4956
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccgqpcU3.out file, please attach this to
your bugreport.

I am using gcc 4.0.1 on Fedora Core 4. The output of gcc -v is

Using built-in specs.
Target: i386-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=i386-redhat-linux
Thread model: posix
gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)


The contents of the file bug.cpp are:

--

template< template<int (*)(int)> class T, int (*f)(int) >
class A {
public:
        static int fun(int x) { return f(x); }
        T<fun> t;
};

int main() { return 0; }
--

The preporcessed source:
--
// /usr/libexec/gcc/i386-redhat-linux/4.0.1/cc1plus -quiet -D_GNU_SOURCE
bug.cpp -quiet -dumpbase bug.cpp -auxbase bug -o - -frandom-seed=0
# 1 "bug.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "bug.cpp"

template< template<int (*)(int)> class T, int (*f)(int) >
class A {
public:
 static int fun(int x) { return f(x); }
 T<fun> t;
};

int main() { return 0; }
--


-- 
           Summary: internal compiler error: in uses_template_parms, at
                    cp/pt.c:4956
           Product: gcc
           Version: 4.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: szhorvat at gmail dot com


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

Reply via email to