This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/51948] [4.6/4.7 Regression][OOP] Rejects valid: Function result value in MOVE_ALLOC, nested in SELECT TYPE
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 23 Jan 2012 11:43:18 +0000
- Subject: [Bug fortran/51948] [4.6/4.7 Regression][OOP] Rejects valid: Function result value in MOVE_ALLOC, nested in SELECT TYPE
- Auto-submitted: auto-generated
- References: <bug-51948-4@http.gcc.gnu.org/bugzilla/>
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