Dear Tobias,

The following example that you provided:

> Do you mean something like the following:
>
> !------------------------------------
> type t
>  integer :: i = 5
> end type t
> type, extends(t) :: t2
>  integer :: j = 6
> end type t2
>
> class(t), allocatable :: a(:), b(:), c(:)
> allocate(t :: a(3))
> allocate(t :: b(5))
> allocate(t :: c(8))
> c = [ a, b ]
> select type(c)
>  type is(t)
>    print '(*(i2))', c%i
>  type is(t2)
>    print '(*(i2))', c%i
>    print '(*(i2))', c%j
> end select
> end
> !------------------------------------

Is exactly the abomination that I did not want to exist!  What happens
if 'a' and 'b' have different dynamic types?
>
> That's accepted by the Cray compiler (7.1.4.111) and produces:
>  5 5 5 5 5 5 5 5
> Though, if one changes "t ::" to "t2 ::", the result is the slightly
> surprising
>  5 5 6 6 5 5 5 5
>  6 5 5 5 6 6 6 6
>
> I think that code is valid Fortran 2003/2008. But to cheer you up: Unlimited
> polymorphic expressions are not allowed in array constructors (cf. C4107).

Surely it cannot be valid?


> Can you add a small note in the comment before the function which mentions
> that eltype == NULL_TREE is handed in a special way?
>

No problem.

Thanks for the review.

Cheers

Paul

PS I know how to fix PR51634.... will get on to it as soon as I have a moment.

Reply via email to