URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.dg/] [abstract_type_5.f03] - Rev 414
Go to most recent revision | Compare with Previous | Blame | View Log
! { dg-do "compile" }
! Abstract Types.
! Check for correct handling of abstract-typed base object references.
MODULE m
IMPLICIT NONE
TYPE, ABSTRACT :: abstract_t
INTEGER :: i
CONTAINS
PROCEDURE, NOPASS :: proc
PROCEDURE, NOPASS :: func
END TYPE abstract_t
TYPE, EXTENDS(abstract_t) :: concrete_t
END TYPE concrete_t
CONTAINS
SUBROUTINE proc ()
IMPLICIT NONE
! Do nothing
END SUBROUTINE proc
INTEGER FUNCTION func ()
IMPLICIT NONE
func = 1234
END FUNCTION func
SUBROUTINE test ()
IMPLICIT NONE
TYPE(concrete_t) :: obj
! These are ok.
obj%abstract_t%i = 42
CALL obj%proc ()
PRINT *, obj%func ()
! These are errors (even though the procedures are not DEFERRED!).
CALL obj%abstract_t%proc () ! { dg-error "is of ABSTRACT type" }
PRINT *, obj%abstract_t%func () ! { dg-error "is of ABSTRACT type" }
END SUBROUTINE test
END MODULE m
! { dg-final { cleanup-modules "m" } }
Go to most recent revision | Compare with Previous | Blame | View Log