!standard 3.9.3(8/3) 10-04-02 AI05-0203-1/02 !class binding interpretation 10-02-13 !status Amendment 2012 10-04-02 !status ARG Approved 10-0-0 10-02-28 !status work item 10-02-13 !status received 09-09-24 !priority Low !difficulty Easy !qualifier Omission !subject A return_subtype_indication cannot denote an abstract subtype !summary A return_subtype_indication cannot denote an abstract subtype. !question There does not seems to be a rule that makes this illegal, although surely it must be: function Func return Abstract_Type'Class is begin return X : Abstract_Type; end Func; Nothing in 3.9.3(8) applies to this (since it's not an object_declaration). !recommendation (See Summary.) !wording Add after the fifth sentence of 3.9.3(8/3) (as modified by AI05-0073-1): The type denoted by a return_subtype_indication (see 6.5) shall not be abstract. !discussion In the example in the question, the function is legal because it is returning a class-wide type, which is never abstract (3.9.3(1.2/2)). Since any type that is covered by the class-wide type is allowed in the extended_return_statement, we could use a specific abstract type as shown. So we need to explcitly disallow this case. !corrigendum 3.9.3(8/3) @drepl The type of an @fa, or of an object created by an @fa or an @fa, or a generic formal object of mode @b, shall not be abstract. The type of the target of an assignment operation (see 5.2) shall not be abstract. The type of a component shall not be abstract. If the result type of a function is abstract, then the function shall be abstract. If a function has an access result type designating an abstract type, then the function shall be abstract. A generic function shall not have an abstract result type or an access result type designating an abstract type. @dby The type of an @fa, or of an object created by an @fa or an @fa, or a generic formal object of mode @b, shall not be abstract. The type of the target of an assignment operation (see 5.2) shall not be abstract. The type of a component shall not be abstract. If the result type of a function is abstract, then the function shall be abstract. If a function has an access result type designating an abstract type, then the function shall be abstract. The type denoted by a @fa (see 6.5) shall not be abstract. A generic function shall not have an abstract result type or an access result type designating an abstract type. !ACATS Test An ACATS B-Test should be created that checks this rule. !appendix !topic Extended return with abstract type?? !reference 3.9.3(8), 6.5 !from Adam Beneschan 09-11-24 !discussion One more for the "abstract screwups" AI (AI05-73), maybe: I can't find anything in 3.9.3(8) or 6.5 that makes this illegal, although surely it must be: function Func return Abstract_Type'Class is begin return X : Abstract_Type; end Func; Nothing in 3.9.3(8) applies to this (since it's not an object_declaration). **************************************************************** From: Edmond Schonberg Sent: Tuesday, November 24, 2009 2:01 PM Well, there is 3.1 (6/2) ... " In addition, an extended_return_statement is a declaration of its defining identifier" but this is rather oblique, and does not correspond explicitly to the categories described in 3.9.3 (8). ****************************************************************