Subclasses of NSManagedObject do not call constructors for C++ ivars.

Originator:frank.illenberger
Number:rdar://16712176 Date Originated:24-Apr-2014 05:02 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 5.1.1 / Mac OS 10.9.2
Classification:Serious Problem Reproducible:Always
 
Summary:
The constructors of C++-ivars of regular Objective-C classes get called during the allocation of the Objective-C object (+allocWithZone:)
For NSManagedObjects, these constructors are never called!

Steps to Reproduce:
- Build and run the project "CoreDataCppBug" with Xcode under MacOS 10.9 (https://github.com/depth42/CoreDataCPPBug)
 - Check the console output


Expected Results:
The program should exit without any output


Actual Results:
The program outputs an assertion failure:
*** Assertion failure in int main(int, const char **)(), CoreDataCPPBug/main.mm:43
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Constructor has not been called.'

Comments


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!