The following invalid code snippet triggers an ICE on mainline:

==============================
template<int> void foo()
{
  throw A();
  struct A {} a;
}

template void foo<0>();
==============================

bug.cc: In function 'void foo()':
bug.cc:3: error: there are no arguments to 'A' that depend on a template
parameter, so a declaration of 'A' must be available
bug.cc:3: error: (if you use '-fpermissive', G++ will accept your code, but
allowing the use of an undeclared name is deprecated)
bug.cc: In function 'void foo() [with int <anonymous> = 0]':
bug.cc:7:   instantiated from here
bug.cc:3: error: 'A' was not declared in this scope
bug.cc: At global scope:
bug.cc: In instantiation of 'foo() [with int <anonymous> = 0]::A':
bug.cc:4:   instantiated from 'void foo() [with int <anonymous> = 0]'
bug.cc:7:   instantiated from here
bug.cc:4: internal compiler error: Segmentation fault
Please submit a full bug report, [etc.]


-- 
           Summary: [4.2 regression] ICE throwing undeclared object
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, error-recovery, monitored
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org


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

Reply via email to