This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/66408] New: deferred-length character & overloaded assignment
- From: "werner.blokbuster at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 03 Jun 2015 16:47:04 +0000
- Subject: [Bug fortran/66408] New: deferred-length character & overloaded assignment
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66408
Bug ID: 66408
Summary: deferred-length character & overloaded assignment
Product: gcc
Version: 5.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: werner.blokbuster at gmail dot com
Target Milestone: ---
The following code:
module mytest
implicit none
type vary
character(:), allocatable :: string
end type vary
interface assignment(=)
module procedure char_eq_vary
end interface assignment(=)
contains
subroutine char_eq_vary(my_char,my_vary)
character(:), allocatable, intent(out) :: my_char
type(vary), intent(in) :: my_vary
my_char = my_vary%string
end subroutine char_eq_vary
end module mytest
program thistest
use mytest, only: vary, assignment(=)
implicit none
character(:), allocatable :: test_char
type(vary) :: test_vary
type(vary) :: my_stuff
test_vary%string = 'example string'
write(*,*) test_vary%string
my_stuff%string = test_vary
write(*,*) my_stuff%string
test_char = test_vary
write(*,*) test_char
my_stuff = test_vary
write(*,*) my_stuff%string
end program thistest
outputs
example string
example string
example string
- I was expecting the third write to also give " example string".
I also get the same output with version 4.9.2.