[cfe-dev] objc_subclassing_restricted attribute bug
Aaron Ballman via cfe-dev
cfe-dev at lists.llvm.org
Thu Oct 13 05:38:03 PDT 2016
On Thu, Oct 13, 2016 at 8:30 AM, Alfred Zien via cfe-dev
<cfe-dev at lists.llvm.org> wrote:
> Hi! Found a bug. If you add objc_subclassing_restricted attribute to both
> parent and child classes it compiles without any error. So attribute appears
> to be useless, as you can't rely on it.
Do you have -Wunknown-attributes enabled? You should get a diagnostic
telling you that the unknown attribute is unsupported, as that is not
an attribute Clang understands (it's not listed in Attr.td).
(http://coliru.stacked-crooked.com/a/eb3ba9326e8648ea)
~Aaron
>
> Code to reproduce bug:
>
> #import <Foundation/Foundation.h>
>
> #define FINAL __attribute__((objc_subclassing_restricted))
>
> FINAL
> @interface Parent : NSObject
> @end
> @implementation Parent
> @end
>
> FINAL
> @interface Child : Parent
> @end
> @implementation Child
> @end
>
> int main(int argc, const char * argv[]) {
> return 0;
> }
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
More information about the cfe-dev
mailing list