OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.dg/] [extends_6.f03] - Rev 302

Go to most recent revision | Compare with Previous | Blame | View Log

! { dg-do compile }
! Some errors pointed out in the development of the patch.
!
! Contributed by Tobias Burnus  <burnus@net-b.de>
!
module m
  type :: date
    private
    integer :: yr, mon
    integer,public :: day
  end type
  type :: dt
    integer :: yr, mon
    integer :: day
  end type
end module m

  use m
  type, extends(date) :: datetime
    integer :: hr, min, sec
  end type
  type(datetime) :: o_dt

  type :: one
    integer :: i
  end type one

  type, extends(one) :: two
    real :: r
  end type two

  o_dt%day = 5  ! VALID but failed in first version of EXTENDS patch
  o_dt%yr  = 5  ! { dg-error "is a PRIVATE component of" }

  t = two(one = one(4), i = 5, r=4.4) ! { dg-error "has already been set" }

  call foo
contains
  subroutine foo
    use m, date_type => dt
    type, extends(date_type) :: dt_type
    end type
    type (dt_type) :: foo_dt
    foo_dt%date_type%day = 1
    foo_dt%dt%day = 1 ! { dg-error "not a member" }
  end subroutine
end

! { dg-final { cleanup-modules "m" } }

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.