diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/abstract_type_3.f03 | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
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.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/abstract_type_3.f03')
-rw-r--r-- | gcc/testsuite/gfortran.dg/abstract_type_3.f03 | 52 |
1 files changed, 52 insertions, 0 deletions
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" } } |