diff options
Diffstat (limited to 'gcc/testsuite/gfortran.dg/impure_2.f08')
-rw-r--r-- | gcc/testsuite/gfortran.dg/impure_2.f08 | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/impure_2.f08 b/gcc/testsuite/gfortran.dg/impure_2.f08 new file mode 100644 index 000000000..4bc2ca1fb --- /dev/null +++ b/gcc/testsuite/gfortran.dg/impure_2.f08 @@ -0,0 +1,27 @@ +! { dg-do compile } +! { dg-options "-std=f2008" } + +! PR fortran/45197 +! Check for errors with IMPURE. + +! Contributed by Daniel Kraft, d@domob.eu. + +MODULE m + IMPLICIT NONE + +CONTAINS + + IMPURE PURE SUBROUTINE foobar () ! { dg-error "must not appear both" } + + PURE ELEMENTAL IMPURE FUNCTION xyz () ! { dg-error "must not appear both" } + + IMPURE ELEMENTAL SUBROUTINE mysub () + END SUBROUTINE mysub + + PURE SUBROUTINE purified () + CALL mysub () ! { dg-error "is not PURE" } + END SUBROUTINE purified + +END MODULE m + +! { dg-final { cleanup-modules "m" } } |