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

           Summary: ICE on invalid code (method implementation outside of
                    implementation context)
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: objc
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: nic...@gcc.gnu.org


Here is a minimal testcase --

- (int) method: (int)argument
{
  return argument;
}

The crash is due to the fact that, when we find a method outside an
implementation context, we don't even create a function context.  So, all the
code in the method will be parsed in a void and crash the compiler at the first
reference to the local bind or such like.

We most likely ought to review the code start/closing the method, and if the
method is outside of an implementation context, start/close it normally but
without associating it with a class.  I suppose 'self' could be set to be of
type 'id'.

Thanks

Reply via email to