We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 05941b0 commit ae4a38fCopy full SHA for ae4a38f
src/stdlib_string_type.fypp
@@ -680,9 +680,18 @@ contains
680
!> No output
681
elemental subroutine move_string_string(from, to)
682
type(string_type), intent(inout) :: from
683
- type(string_type), intent(out) :: to
+ type(string_type), intent(inout) :: to
684
+
685
+ if(.not.allocated(from%raw))then
686
+ if(allocated(to%raw))deallocate(to%raw)
687
+ return
688
+ endif
689
- call move_alloc(from%raw, to%raw)
690
+ if(from%raw .eq. to%raw)then
691
+ deallocate(from%raw)
692
+ else
693
+ call move_alloc(from%raw, to%raw)
694
695
696
end subroutine move_string_string
697
0 commit comments