https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106771
--- Comment #3 from federico <federico.perini at gmail dot com> --- Right: here is a version where the object is initialized: https://godbolt.org/z/o566cPG8P I also see that for the versions that compile (e.g., 11.1.0), there's a weird SEGFAULT error at this line: elemental logical function isa(this,i) class(t), intent(in) :: this integer, intent(in) :: i integer :: n n = merge(size(this%iloc),0,allocated(this%iloc)) if (i>0 .and. i<=n) then ! Segmentation fault here isa = this%iloc(i)>0 else isa = .false. endif end function isa So it at least compiles, but apparently the bug is hidden somewhere else?