The following invalid testcase triggers an ICE since gcc 4.0.0:

===============================
struct A
{
    static void foo() = 0;
};
===============================

The error message is:

  bug.cc:3: internal compiler error: in grokfield, at cp/decl2.c:899
  Please submit a full bug report, [etc.]

The respective code from cp/decl2.c reads:

   /* Initializers for functions are rejected early in the parser.
      If we get here, it must be a pure specifier for a method.  */
   gcc_assert (TREE_CODE (TREE_TYPE (value)) == METHOD_TYPE);
   gcc_assert (error_operand_p (init) || integer_zerop (init));
   DECL_PURE_VIRTUAL_P (value) = 1;

Apparently the first assert is triggered - we have a FUNCTION_TYPE
instead of a METHOD_TYPE in this example. This was probably broken by
Giovanni's patch for PR17401.

-- 
           Summary: [4.0/4.1 regression] ICE on pure specifier for static
                    method
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, monitored
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org,giovannibajo at libero
                    dot it


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

Reply via email to