From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/gfortran.dg/abstract_type_3.f03 | 52 +++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/abstract_type_3.f03 (limited to 'gcc/testsuite/gfortran.dg/abstract_type_3.f03') diff --git a/gcc/testsuite/gfortran.dg/abstract_type_3.f03 b/gcc/testsuite/gfortran.dg/abstract_type_3.f03 new file mode 100644 index 000000000..79bc131e0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/abstract_type_3.f03 @@ -0,0 +1,52 @@ +! { dg-do compile } + +! Abstract Types. +! Check for errors when using abstract types in an inappropriate way. + +MODULE m + USE ISO_C_BINDING + IMPLICIT NONE + + TYPE, ABSTRACT, BIND(C) :: bindc_t ! { dg-error "must not be ABSTRACT" } + INTEGER(C_INT) :: x + END TYPE bindc_t + + TYPE, ABSTRACT :: sequence_t ! { dg-error "must not be ABSTRACT" } + SEQUENCE + INTEGER :: x + END TYPE sequence_t + + TYPE, ABSTRACT :: abst_t + INTEGER :: x = 0 + END TYPE abst_t + + TYPE, EXTENDS(abst_t) :: concrete_t + INTEGER :: y = 1 + END TYPE concrete_t + + TYPE :: myt + TYPE(abst_t) :: comp ! { dg-error "is of the ABSTRACT type 'abst_t'" } + END TYPE myt + + ! This should be ok. + TYPE, ABSTRACT, EXTENDS(concrete_t) :: again_abst_t + INTEGER :: z = 2 + END TYPE again_abst_t + +CONTAINS + + TYPE(abst_t) FUNCTION func () ! { dg-error "of the ABSTRACT type 'abst_t'" } + END FUNCTION func + + SUBROUTINE sub (arg) ! { dg-error "is of the ABSTRACT type 'again_abst_t'" } + IMPLICIT NONE + TYPE(again_abst_t) :: arg + arg = again_abst_t () ! { dg-error "Can't construct ABSTRACT type 'again_abst_t'" } + END SUBROUTINE sub + + SUBROUTINE impl () + IMPLICIT TYPE(abst_t) (a-z) ! { dg-error "ABSTRACT type 'abst_t' used" } + END SUBROUTINE impl + +END MODULE m +! { dg-final { cleanup-modules "m" } } -- cgit v1.2.3