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/operator_4.f90 | |
download | cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2 cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.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/operator_4.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/operator_4.f90 | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/operator_4.f90 b/gcc/testsuite/gfortran.dg/operator_4.f90 new file mode 100644 index 000000000..39cd7ebdf --- /dev/null +++ b/gcc/testsuite/gfortran.dg/operator_4.f90 @@ -0,0 +1,100 @@ +! PR 17711 : Verify error message text meets operator in source +! { dg-do compile } + +MODULE mod_t + type :: t + integer :: x + end type + + INTERFACE OPERATOR(==) + MODULE PROCEDURE t_eq + END INTERFACE + + INTERFACE OPERATOR(/=) + MODULE PROCEDURE t_ne + END INTERFACE + + INTERFACE OPERATOR(>) + MODULE PROCEDURE t_gt + END INTERFACE + + INTERFACE OPERATOR(>=) + MODULE PROCEDURE t_ge + END INTERFACE + + INTERFACE OPERATOR(<) + MODULE PROCEDURE t_lt + END INTERFACE + + INTERFACE OPERATOR(<=) + MODULE PROCEDURE t_le + END INTERFACE + +CONTAINS + LOGICAL FUNCTION t_eq(this, other) + TYPE(t), INTENT(in) :: this, other + t_eq = (this%x == other%x) + END FUNCTION + + LOGICAL FUNCTION t_ne(this, other) + TYPE(t), INTENT(in) :: this, other + t_ne = (this%x /= other%x) + END FUNCTION + + LOGICAL FUNCTION t_gt(this, other) + TYPE(t), INTENT(in) :: this, other + t_gt = (this%x > other%x) + END FUNCTION + + LOGICAL FUNCTION t_ge(this, other) + TYPE(t), INTENT(in) :: this, other + t_ge = (this%x >= other%x) + END FUNCTION + + LOGICAL FUNCTION t_lt(this, other) + TYPE(t), INTENT(in) :: this, other + t_lt = (this%x < other%x) + END FUNCTION + + LOGICAL FUNCTION t_le(this, other) + TYPE(t), INTENT(in) :: this, other + t_le = (this%x <= other%x) + END FUNCTION +END MODULE + +PROGRAM pr17711 + USE mod_t + + LOGICAL :: A + INTEGER :: B + TYPE(t) :: C + + A = (A == B) ! { dg-error "comparison operator '=='" } + A = (A.EQ.B) ! { dg-error "comparison operator '.eq.'" } + A = (A /= B) ! { dg-error "comparison operator '/='" } + A = (A.NE.B) ! { dg-error "comparison operator '.ne.'" } + A = (A <= B) ! { dg-error "comparison operator '<='" } + A = (A.LE.B) ! { dg-error "comparison operator '.le.'" } + A = (A < B) ! { dg-error "comparison operator '<'" } + A = (A.LT.B) ! { dg-error "comparison operator '.lt.'" } + A = (A >= B) ! { dg-error "comparison operator '>='" } + A = (A.GE.B) ! { dg-error "comparison operator '.ge.'" } + A = (A > B) ! { dg-error "comparison operator '>'" } + A = (A.GT.B) ! { dg-error "comparison operator '.gt.'" } + + ! this should also work with user defined operators + A = (A == C) ! { dg-error "comparison operator '=='" } + A = (A.EQ.C) ! { dg-error "comparison operator '.eq.'" } + A = (A /= C) ! { dg-error "comparison operator '/='" } + A = (A.NE.C) ! { dg-error "comparison operator '.ne.'" } + A = (A <= C) ! { dg-error "comparison operator '<='" } + A = (A.LE.C) ! { dg-error "comparison operator '.le.'" } + A = (A < C) ! { dg-error "comparison operator '<'" } + A = (A.LT.C) ! { dg-error "comparison operator '.lt.'" } + A = (A >= C) ! { dg-error "comparison operator '>='" } + A = (A.GE.C) ! { dg-error "comparison operator '.ge.'" } + A = (A > C) ! { dg-error "comparison operator '>'" } + A = (A.GT.C) ! { dg-error "comparison operator '.gt.'" } +END PROGRAM + +! { dg-final { cleanup-modules "mod_t" } } |