view gcc/testsuite/gfortran.dg/implicit_class_1.f90 @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { dg-do run }
! { dg-skip-if "" { powerpc-ibm-aix* } }
!
! PR 56500: [OOP] "IMPLICIT CLASS(...)" wrongly rejected
!
! Contributed by Reinhold Bader <Reinhold.Bader@lrz.de>

! Add dump-fortran-original to check, if the patch preventing a gfortran
! segfault is working correctly.  No cleanup needed, because the dump
! goes to stdout.
! { dg-options "-fdump-fortran-original" }
! { dg-allow-blank-lines-in-output 1 }
! { dg-prune-output "Namespace:.*-{42}" }

program upimp
  implicit class(foo) (a-b)
  implicit class(*) (c)
  type :: foo
    integer :: i
  end type
  allocatable :: aaf, caf

  allocate(aaf, source=foo(2))
  select type (aaf)
  type is (foo)
    if (aaf%i /= 2) STOP 1
  class default
    STOP 2
  end select

  allocate(caf, source=foo(3))
  select type (caf)
  type is (foo)
    if (caf%i /= 3) STOP 3
  class default
    STOP 4
  end select

contains
  subroutine gloo(x)
    implicit class(*) (a-z)
  end
end program