Bug 39822 - ICE: Segmentation fault -- with function template default template arguments in c++0x mode
Summary: ICE: Segmentation fault -- with function template default template arguments ...
Status: RESOLVED DUPLICATE of bug 35828
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.3.4
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-20 17:28 UTC by Andreas Beckmann
Modified: 2009-04-22 23:55 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.3.4 4.4.0 4.5.0
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Beckmann 2009-04-20 17:28:15 UTC
The following testcase produces a segmentation fault in --std=c++0x mode (in 4.3, 4.4, 4.5):

----- 8< -----
template < typename >
struct A ;
template < typename X, template < typename > class = A >
void test ( X )
{
        A < int > T ;
        test ( T ) ;
}
----- >8 -----

===== 4.3.4 -std=c++0x =====
$ x86_64-linux-gnu-g++-4.3.x -v -std=c++0x -c segfault.min.ii

Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4_3-branch/configure --prefix=/opt/software/gcc-x86_64/gcc-4.3.x --program-suffix=-4.3.x --enable-languages=c,c++ --enable-checking
Thread model: posix
gcc version 4.3.4 20090413 (prerelease) (GCC)
COLLECT_GCC_OPTIONS='-v' '-std=c++0x' '-c' '-shared-libgcc' '-mtune=generic'
 /opt/software/gcc-x86_64/gcc-4.3.x/libexec/gcc/x86_64-unknown-linux-gnu/4.3.4/cc1plus -fpreprocessed segfault.min.ii -quiet -dumpbase segfault.min.ii -mtune=generic -auxbase segfault.min -std=c++0x -version -o /tmp/cccslkh4.s
GNU C++ (GCC) version 4.3.4 20090413 (prerelease) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.3.4 20090413 (prerelease), GMP version 4.2.2, MPFR version 2.3.1.
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 922fef518d0100daafe6c2059a02f6bf
segfault.min.ii: In function 'void test(X)':
segfault.min.ii:2: internal compiler error: Segmentation fault
===== =====

===== 4.3.4 =====
$ x86_64-linux-gnu-g++-4.3.x -c segfault.min.ii

segfault.min.ii:4: error: default template arguments may not be used in function templates
segfault.min.ii: In function 'void test(X)':
segfault.min.ii:7: error: no matching function for call to 'test(A<int>&)'
==========
Comment 1 Paolo Carlini 2009-04-20 17:41:26 UTC
Maybe Jason is willing to have a look...
Comment 2 Andreas Beckmann 2009-04-20 17:50:55 UTC
probably a duplicate of bug #35828
Comment 3 Andrew Pinski 2009-04-22 23:55:34 UTC

*** This bug has been marked as a duplicate of 35828 ***