view gcc/testsuite/gfortran.dg/implicit_class_1.f90 @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 04ced10e8804
children 84e7813d76e9
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) call abort
  class default
    call abort
  end select

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

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