1! { dg-do compile }
2! Tests the fix for PR38765 in which the use associated symbol
3! 'fun' was confused with the contained function in 'mod_b'
4! because the real name was being used instead of the 'use'
5! name..
6!
7! Contributed by Paul Thomas  <pault@gcc.gnu.org>
8! from a report by Marco Restelli.
9!
10module mod_a
11  implicit none
12  public :: fun
13  private
14contains
15  pure function fun(x) result(mu)
16    real, intent(in) :: x(:,:)
17    real :: mu(2,2,size(x,2))
18    mu = 2.0
19  end function fun
20end module mod_a
21
22module mod_b
23  use mod_a, only: &
24  a_fun => fun
25  implicit none
26  private
27contains
28  pure function fun(x) result(mu)
29    real, intent(in) :: x(:,:)
30    real :: mu(2,2,size(x,2))
31    mu = a_fun(x)
32  end function fun
33end module mod_b
34