[LLVMbugs] [Bug 7740] New: passing address of reference failing in ObjC++

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 28 17:27:20 PDT 2010


           Summary: passing address of reference failing in ObjC++
           Product: clang
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: james at markzware.com
                CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com

The code below compiles and works as expected on gcc 4.2. However, it fails on
clang with the following error:

error: cannot initialize a parameter of type 'id' with an rvalue of type
'NSString *'

I should work as "NSString *" should be accepted by an 'id' argument.

#include <Cocoa/Cocoa.h>

int main (int argc, char * const argv[]) 

    NSMutableArray * tmpArrPtr = [[NSMutableArray alloc] init];
    NSString* tmpStrPtr = @"test";
    NSString& tmpStr = *tmpStrPtr;

    [tmpArrPtr addObject:&tmpStr];

    return 0;


Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list