https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62176
Dominique d'Humieres <dominiq at lps dot ens.fr> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2014-08-20 Ever confirmed|0 |1 --- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- Reduced test module m_string implicit none type t_string character, dimension(:), allocatable :: buffer integer :: length = 0 integer :: size = 0 contains ! Interfaces for string types generic :: character => string_to_char procedure :: string_to_char ! Element comparison operators procedure :: string_less_equal_char procedure, pass(right) :: char_less_equal_string generic :: operator(<=) => string_less_equal_char, & char_less_equal_string ! Character compatibility interfaces generic :: lle => string_less_equal_char, & char_less_equal_string end type t_string contains ! Return the string as character pure function string_to_char( this ) result(res) class(t_string), intent(in) :: this character(len=this%size) :: res if( allocated(this%buffer) ) then res = transfer( this%buffer(:this%size), res ) else res = '' end if end function string_to_char ! Comparison operator 'string <= character' elemental function string_less_equal_char( left, right ) result(res) class(t_string), intent(in) :: left character(len=*), intent(in) :: right logical :: res res = ( left%character() <= right ) end function string_less_equal_char ! Comparison operator 'character <= string' elemental function char_less_equal_string( left, right ) result(res) character(len=*), intent(in) :: left class(t_string), intent(in) :: right logical :: res res = ( left <= right%character() ) end function char_less_equal_string end module m_string The code compiles if the lines generic :: lle => string_less_equal_char, & char_less_equal_string are commented. I cannot see how 'string_less_equal_char' and 'char_less_equal_string' are ambiguous for 'lle', but not for operator '<='.