Issue 16599: The semantics of destroying part objects without accessible destructor must be specified (alf-rtf) Source: (, ) Nature: Clarification Severity: Significant Summary: In the section "Composition" of 10.5.2 we have the following example: class C { public a: A = new A(); public b: compose B = new B(); } When an instance of class C is destroyed, the object it holds for attribute b will also be automatically destroyed, but the object it holds for attribute a will not. However, assume now that the class B has no accessible destructor. For example, it may have an explicit destructor with parameters and/or non-public visibility so that the default destructor is no longer available (see 10.5.3.2). What will then happen when the C instance is destroyed? We think there should be a constraint that types of composite attributes must have a public constructor with no parameters. If this is missing, it is a static semantic error. Resolution: The FTF agrees that this is an issue worth considering, but, due to lack of time, decided to defer its resolution to a future RTF working on this specification. Revised Text: None Disposition: Deferred Revised Text: Actions taken: October 14, 2011: received issue October 5, 2012: deferred Discussion: End of Annotations:===== m: webmaster@omg.org Date: 14 Oct 2011 06:16:02 -0400 To: Subject: Issue/Bug Report ******************************************************************************* Name: Mattias Mohlin Employer: IBM mailFrom: mattias.mohlin@se.ibm.com Terms_Agreement: I agree Specification: ALF Section: 10.5.2 FormalNumber: ptc/2010-10-05 Version: FTF ­ Beta 1 Doc_Year: 2010 Doc_Month: October Doc_Day: 05 Page: 160-164 Title: The semantics of destroying part objects without accessible destructor must be specified Nature: Clarification Severity: Significant CODE: 3TMw8 B1: Report Issue Description: In the section "Composition" of 10.5.2 we have the following example: class C { public a: A = new A(); public b: compose B = new B(); } When an instance of class C is destroyed, the object it holds for attribute b will also be automatically destroyed, but the object it holds for attribute a will not. However, assume now that the class B has no accessible destructor. For example, it may have an explicit destructor with parameters and/or non-public visibility so that the default destructor is no longer available (see 10.5.3.2). What will then happen when the C instance is destroyed? We think there should be a constraint that types of composite attributes must have a public constructor with no parameters. If this is missing, it is a static semantic error.