2 ! { dg-options "-std=legacy" }
3 ! Tests the fix for PR27122, in which the requirements of 12.3.2.1.1
4 ! for defined operators were not enforced.
6 ! Based on PR test by Thomas Koenig <tkoenig@gcc.gnu.org>
9 interface operator (.foo.)
10 module procedure foo_0 ! { dg-error "must have at least one argument" }
11 module procedure foo_1 ! { dg-error "must be INTENT" }
12 module procedure foo_2 ! { dg-error "cannot be optional" }
13 module procedure foo_3 ! { dg-error "must have, at most, two arguments" }
14 module procedure foo_1_OK
15 module procedure foo_2_OK
16 function foo_chr (chr) ! { dg-error "cannot be assumed character length" }
17 character(*) :: foo_chr
18 character(*), intent(in) :: chr
20 subroutine bad_foo (chr) ! { dg-error "must be a FUNCTION" }
21 character(*), intent(in) :: chr
22 end subroutine bad_foo
36 integer, intent (in) :: a
41 integer, intent(in) :: a
42 integer, intent(in), optional :: b
45 function foo_2_OK (a, b)
49 foo_2_OK = 2.0 * a + b
51 function foo_3 (a, b, c)
53 integer, intent(in) :: a, b, c
57 ! { dg-final { cleanup-modules "mymod" } }