module coords_1d

implicit none
private
save

public :: Coords1D

type :: Coords1D
   integer :: n
   integer :: d
   real, allocatable :: ifc(:,:)
end type Coords1D

interface Coords1D
   module procedure new_Coords1D_from_fields
end interface

contains

function new_Coords1D_from_fields(ifc) result(coords)
  real, intent(in) :: ifc(:,:)
  type(Coords1D) :: coords

  coords%n = size(ifc, 1)
  coords%d = size(ifc, 2) - 1

  allocate(coords%ifc(coords%n,coords%d+1))

  coords%ifc = ifc

end function new_Coords1D_from_fields

end module coords_1d

program test_array_constructor

use coords_1d

implicit none

type(Coords1D) :: foo

real :: bar(5,5) = 1.

#ifdef TRIGGER_BUG
foo = Coords1D(1./bar)
#else
foo = Coords1D(bar)
#endif

end program test_array_constructor
