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

             Bug #: 56241
           Summary: ICE in toplev.c:332 on invalid
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: ppluzhni...@google.com


This is a result of test reduction gone bad. The test is invalid, but shouldn't
crash the compiler.

struct pair {
  constexpr pair (const) :
  };
template < 0 >
make_pair () {
}
pair prefix[] = { 0, make_pair }

Using g++ (GCC) 4.8.0 20130205 (experimental):

g++ -c -std=c++11 t.ii
t.ii:2:19: error: ISO C++ forbids declaration of ‘parameter’ with no type
[-fpermissive]
   constexpr pair (const) :
                   ^
t.ii: In constructor ‘constexpr pair::pair(int)’:
t.ii:2:26: error: expected identifier at end of input
   constexpr pair (const) :
                          ^
t.ii:2:26: error: expected ‘{’ at end of input
t.ii: At global scope:
t.ii:4:12: error: expected identifier before numeric constant
 template < 0 >
            ^
t.ii:4:12: error: expected ‘>’ before numeric constant
t.ii:5:12: error: ISO C++ forbids declaration of ‘make_pair’ with no type
[-fpermissive]
 make_pair () {
            ^
t.ii:7:32: error: conversion from ‘<unresolved overloaded function type>’ to
non-scalar type ‘pair’ requested
 pair prefix[] = { 0, make_pair }
                                ^
t.ii:7:32: internal compiler error: Segmentation fault
0xa7fd6f crash_signal
    ../../gcc/toplev.c:332
0xc69563 non_type_check
    ../../gcc/tree.h:3847
0xc69563 build_constructor(tree_node*, vec<constructor_elt_d, va_gc,
vl_embed>*)
    ../../gcc/tree.c:1422
...

Reply via email to