Quantcast
Channel: Intel® Software - Intel® Visual Fortran Compiler for Windows*
Viewing all articles
Browse latest Browse all 5691

Generic procedures: non-ambiguous at declaration or use?

$
0
0

Consider this

 


    module generics

    Type T
    contains
    procedure :: A
    procedure :: B
    generic :: C=>A, B
    end type T
    contains

    subroutine A(X,Y,Z)
    class(T) X
    real Y
    real, optional :: Z
    end subroutine

    subroutine B(X,Y,Z)
    class(T) X
    class(*), optional :: Y, Z
    end subroutine

    end module generics 

The two subroutines are ambiguous (e.g. for C%(x,1.,2.)). But ifort accepts this when you compile the module, rejecting it only  if you try to use it in any way that is ambiugous. gfortran rejects it as soon as you compile the module. So when is non-ambiguity required? The standard doesn't seem to be very obviously clear on this.

For libraries it would be useful to have at least some compile-time warning that there may be ambiguous call cases.


Viewing all articles
Browse latest Browse all 5691

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>