Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
37 Views

Compiler Bug: parameterized derived type - omitted field in initialization

Hi,

I am facing a compiler error when trying to initialize a parameterized derived type omitting a component with default value.

This only happens when the derived type is accessed by host association, and also in a default initialization in the declaration statement.

 

module pdt
  implicit none

  type :: host_pdt(n)
    integer, len :: n
    integer :: x = 99
  end type
end

program test
  use :: pdt
  implicit none

  type :: prog_pdt(n)
    integer, len :: n
    integer :: x = 99
  end type

  type(prog_pdt(5)) :: p = prog_pdt(5)()  ! it works with locally declared type
  type(host_pdt(5)) :: h1 = host_pdt(5)()  ! error #8212: Omitted field is not initialized. Field initialization missing:   
  type(host_pdt(5)) :: h2
  h2 = host_pdt(5)()  ! this works, though
end

My compiler version is Intel Compiler 18.0 x64 on windows 10, and I am not using any compiler option.

0 Kudos
0 Replies