Index: clang/lib/Sema/SemaDeclAttr.cpp =================================================================== --- clang/lib/Sema/SemaDeclAttr.cpp +++ clang/lib/Sema/SemaDeclAttr.cpp @@ -2570,8 +2570,9 @@ static void handleVisibilityAttr(Sema &S, Decl *D, const ParsedAttr &AL, bool isTypeVisibility) { - // Visibility attributes don't mean anything on a typedef. - if (isa(D)) { + // Visibility attributes don't mean anything on a typedef, and aren't + // permitted on an @implementation. + if (isa(D) || isa(D)) { S.Diag(AL.getRange().getBegin(), diag::warn_attribute_ignored) << AL; return; } Index: clang/test/Parser/attributes.mm =================================================================== --- clang/test/Parser/attributes.mm +++ clang/test/Parser/attributes.mm @@ -15,9 +15,11 @@ @interface EXP I @end // expected-error {{postfix attributes are not allowed on Objective-C directives, place them in front of '@interface'}} EXP @interface I2 @end +EXP @interface I2 (Cat) @end @implementation EXP I @end // expected-error-re {{postfix attributes are not allowed on Objective-C directives{{$}}}} -EXP @implementation I2 @end +EXP @implementation I2 @end // expected-warning{{attribute ignored}} +EXP @implementation I2 (Cat) @end // expected-warning{{attribute ignored}} @class EXP OC; // expected-error-re {{postfix attributes are not allowed on Objective-C directives{{$}}}} EXP @class OC2; // expected-error {{prefix attribute must be followed by an interface, protocol, or implementation}}