summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/init_char_with_nonchar_ctr.f90
blob: 301118266456545b87db557fb58cbaffbd9b8e5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
! { 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