https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66545

--- Comment #2 from Gerhard Steinmetz <gerhard.steinmetz.fort...@t-online.de> 
---
FYI, it's astonishing, but this code compiles without an ICE
and prints some reasonable error messages :


$ cat z2_type.f90
program p
   type t
      integer :: n
   end type
   type(t), parameter :: c1 = (t(c1%n))
   type(t), parameter :: c2 = t(c2%n)
   type(t) :: c3 = (t(c3%n))
   type(t) :: c4 = t(c4%n)
   type(t) :: c5
   type(t) :: c6
   c5 = (t(c5%n))
   c6 = t(c6%n)
end


$ gfortran -c z2_type.f90
z2_type.f90:5:33:

    type(t), parameter :: c1 = (t(c1%n))
                                 1
Error: PARAMETER ‘c1’ is used at (1) before its definition is complete
z2_type.f90:6:32:

    type(t), parameter :: c2 = t(c2%n)
                                1
Error: PARAMETER ‘c2’ is used at (1) before its definition is complete
z2_type.f90:7:22:

    type(t) :: c3 = (t(c3%n))
                      1
Error: Parameter ‘c3’ at (1) has not been declared or is a variable, which does
not reduce to a constant expression
z2_type.f90:8:21:

    type(t) :: c4 = t(c4%n)
                     1
Error: Parameter ‘c4’ at (1) has not been declared or is a variable, which does
not reduce to a constant Expression

#
# c5, c6 differs
#

Reply via email to