c++/9452: ICE with templates (no better explanation possible)

bangerth@ticam.utexas.edu bangerth@ticam.utexas.edu
Mon Jan 27 16:20:00 GMT 2003


>Number:         9452
>Category:       c++
>Synopsis:       ICE with templates (no better explanation possible)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 27 16:06:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator:     Wolfgang Bangerth
>Release:        unknown-1.0
>Organization:
>Environment:

>Description:
OK, this is #1 of 7 (this weekends batch of ICE findings :-( )

This crashes every gcc since at least 2.95 with a SegFault:
----------------------------------
template <int> struct Len   { static const int val = 1; };
template <int> struct X {};

template <typename T> void foo(X<1>) {};

template <typename T, int N>
X<Len<N>::val-1>
foo(X<N>) {
  foo<int> (X<N>());
};

int main () {
  foo<int>(X<1>());
};
--------------------------------

g/a> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c bug32-1.cc
bug32-1.cc: In function `int main()':
bug32-1.cc:13: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list