Skip to content

Property of reference type not supported for Objective-C++ #10480

@llvmbot

Description

@llvmbot
Bugzilla Link 10108
Resolution FIXED
Resolved on Jun 16, 2011 12:08
Version 2.9
OS MacOS X
Reporter LLVM Bugzilla Contributor
CC @DougGregor

Extended Description

GCC supports reference types for properties in Objective-C++ mode. This is not supported by clang even when using -std=gnu++0x.

Example:

% cat main.mm
#import <Foundation/Foundation.h>

@​interface Test : NSObject { int i; }
@​property (readonly) int const& i;
@​end

@​implementation Test
@​synthesize i;
@​end

int main (int argc, char const* argv[]) { return 0; }

----------8<----------

% clang++ -std=gnu++0x -lobjc -framework Foundation main.mm
main.mm:4:1: error: property of reference type is not supported
@​property (readonly) int const& i;
^
main.mm:8:13: error: property implementation must have its declaration in interface 'Test'
@​synthesize i;
^
2 errors generated.

----------8<----------

Using references is required when wrapping non-POD types in an Objective-C class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions