http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51948
Tobias Burnus <burnus at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.6.3
Summary|[OOP] Rejects valid: |[4.6/4.7 Regression][OOP]
|Polymorphic arguments in |Rejects valid: Function
|MOVE_ALLOC |result value in MOVE_ALLOC,
| |nested in SELECT TYPE
--- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2012-01-23
11:43:18 UTC ---
The second example is wrong - and it works after fixing it: s/func/func2/.
This program compiles with GCC 4.5 (and fails with 4.6/4.7) - thus, I marked
the PR as regression.
Better example (still based on periodic_6th_order.F90). The SELECT TYPE is
crucial, a simple ASSOCIATE or BLOCK won't do:
call move_alloc (x, func)
1
Error: 'to' argument of 'move_alloc' intrinsic at (1) must be a variable
The program
type :: t
end type t
contains
function func(x, y)
class(t) :: y ! Dummy variable
type(t), allocatable :: func ! Can also be CLASS
type(t), allocatable :: x ! Can also be CLASS
! call move_alloc (x, func) ! <<< Works
select type (y)
type is(t)
call move_alloc (x, func) ! << Error (but no select variable involved)
end select
end function
end