view gcc/testsuite/gfortran.dg/init_char_with_nonchar_ctr.f90 @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents 1830386684a0
children
line wrap: on
line source

! { dg-do compile }

! Initialization of character by non-character constructor

subroutine s1
   type t
      integer :: n = 0
   end type
   type t2
      character :: c = t() ! { dg-error "Cannot convert TYPE\\(t\\) to CHARACTER\\(1\\)" }
   end type
end subroutine

subroutine s2
   type t
   end type
   type t2
      character :: c(1) = [t()] ! { dg-error "Cannot convert TYPE\\(t\\) to CHARACTER\\(1\\)" }
   end type
end subroutine

subroutine s3
   type t
      integer :: a = 1
      character :: c = t() ! { dg-error "Cannot convert TYPE\\(t\\) to CHARACTER\\(1\\)" }
   end type
end subroutine

subroutine s4
   type t
      integer, allocatable :: a
      character :: c = t() ! { dg-error "Cannot convert TYPE\\(t\\) to CHARACTER\\(1\\)" }
   end type
end subroutine