Skip to content

error: synthesized property 'virtualProperty' must either be named the same as #3807

@llvmbot

Description

@llvmbot
Bugzilla Link 3435
Resolution FIXED
Resolved on Mar 12, 2010 00:57
Version unspecified
OS MacOS X
Reporter LLVM Bugzilla Contributor
CC @tkremenek

Extended Description

Constructs of the form:

@​interface MyClass {
}
@​property (nonatomic, readonly) BOOL virtualProperty;
@​end

@​implementation MyClass
@​synthesize virtualProperty;

  • (BOOL)virtualProperty {
    return NO;
    }
    @​end

trigger an error on the Static analyzer with the message:

error: synthesized property 'virtualProperty' must either be named the same as a compatible ivar or must explicitly name an ivar

Now I know that I should really be using @​dynamic in this case, but the compiler accepts this on the grounds that (from the documentation) "You use the @​synthesize keyword to tell the compiler that it should synthesize the setter and/or getter methods for the property if you do not supply them within the @​implementation block."

Note that using @​dynamic lets the parser go through the file without a hitch. I'll be switching to @​dynamic in my code for these, but I still think that anything accepted by the compiler should also be by the analyzer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillaclang:frontendLanguage frontend issues, e.g. anything involving "Sema"

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions