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

           Summary: ObjC++ compiler fails to compile ObjC method
                    invocations without keyword arguments
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: objc++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: nic...@gcc.gnu.org


The following testcase

/* Contributed by Nicola Pero <nicola.p...@meta-innovation.com>, May 2011.  */
#include <objc/objc.h>

@interface A
- (id) method:(id)arg0 :(id)arg1;
@end

id function (A *x)
{
  return [x method:x :x];
}

fails to compile as Objective-C++ with GCC 4.7.0:

[nicola@lampone ~]$ gcc test.mm -c
test.mm: In function ‘objc_object* function(A*)’:
test.mm:10:22: error: found ‘:’ in nested-name-specifier, expected ‘::’
test.mm:10:20: error: ‘x’ is not a class or namespace
test.mm:10:24: warning: ‘A’ may not respond to ‘-method:’ [enabled by default]
test.mm:10:24: warning: (Messages without a matching method signature [enabled
by default]
test.mm:10:24: warning: will be assumed to return ‘id’ and accept [enabled by
default]
test.mm:10:24: warning: ‘...’ as arguments.) [enabled by default]
[nicola@lampone ~]$

It compiles as Objective-C (ie, if you rename the file as test.m).  It also
compiles with much older compilers, such as GCC 4.1.2.

This testcase was distilled from a bug reported by Banlu Kemiyatorn.

I'd consider this slightly higher priority than the usual Objective-C++ 
testcase because what is broken is actually part of the basic Objective-C 
language syntax.

Thanks

Reply via email to