J3/04-336r1
Date: 10 June 2004
To: J3
From: Rob James
Subject: Allocating objects of abstract types
NUMBER:
TITLE: Allocating objects of abstract types
KEYWORDS: ALLOCATE, ABSTRACT
DEFECT TYPE:
STATUS: J3 consideration in progress
QUESTION:
Consider the following code:
module m
type, abstract :: t
integer :: i
end type
class(t), allocatable :: d
end module
program foo
use m
allocate(d)
end
One cannot declare a non-polymorphic object of an abstract type.
Similarly, a polymorphic object should not be allocated with a dynamic
type that is abstract.
A in an allocate statement cannot specify an abstract
type. But the effect of the allocate statement in the example above
is the same as if a specifying an abstract type appeared
in the allocate statement, which would not be standard-conforming.
Was this example intended to be standard-conforming?
ANSWER:
No, this example was not intended to be standard-conforming. An edit
is provided to correct this oversight.
EDITS:
This edit refers to 04-007.
[111:12+] Add the following constraint:
C625.1 (R623) If any has a declared type that is
abstract, either or SOURCE= shall apear.
SUBMITTED BY: Rob James
HISTORY: 04-336 m169 Submitted