objc_subclassing_restricted ob both parent and child classes gives no error.

Originator:zienag
Number:rdar://28753587 Date Originated:13-Oct-2016 04:08 PM
Status:Closed Resolved:No
Product:Developer Tools Product Version:8.0
Classification: Reproducible:Yes
 
Summary:
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.

Steps to Reproduce:
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;
}

Expected Results:
Compile time error.

Actual Results:
Compiles without errors

Version:
Xcode Version 8.0 (8A218a)

OS X El Capitan 10.11.6 (15G1004)

Notes:


Configuration:
$ clang --version
Apple LLVM version 8.0.0 (clang-800.0.38)
Target: x86_64-apple-darwin15.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Attachments:

Comments

This issue seems resolved in Xcode 8.3.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!