1! { dg-do run }
2! Tests the fix for pr31609, where module procedure entries found
3! themselves in the wrong namespace.  This test checks that all
4! combinations of generic and specific calls work correctly.
5!
6! Contributed by Paul Thomas <pault@gcc.gnu.org> as comment #8 to the pr.
7!
8MODULE ksbin1_aux_mod
9  interface foo
10    module procedure j
11  end interface
12  interface bar
13    module procedure k
14  end interface
15  interface foobar
16    module procedure j, k
17  end interface
18  CONTAINS
19    FUNCTION j ()
20    j = 1
21    return
22    ENTRY k (i)
23    k = 2
24    END FUNCTION j
25END MODULE ksbin1_aux_mod
26
27    use ksbin1_aux_mod
28    if (any ((/foo (), bar (99), foobar (), foobar (99), j (), k (99)/) .ne. &
29             (/1, 2, 1, 2, 1, 2/))) Call abort ()
30end
31