Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Generic routine resolution.

cfrieler
Beginner
861 Views
I use a homebrew QSort in two distinct fashions, to sort a collection of objects or to create an ordered set of indices into that collection.

The syntax I would like to use is

Call Sort( ItemVector )

for the former, and

List = Sort( ItemVector )

for the later. I have included both forms in a module and defined the interface for the generic routine with these two as module procedures, in the order above. I get an error when I compile a program which uses the later syntax. It appears that the compiler (CVF6.6c) can't distinguish these two and correctly choose the later module procedures.
"Error: A function reference is invoking an external subroutine subprogram. "

Why can't the compiler detect the usage in an assignment and qualify the signature of a call in order to resolve between these two properly?
If this is fundamentally impossible, why don't I get an error when I compile the Sort module itself?

Thanks
0 Kudos
2 Replies
Steven_L_Intel1
Employee
861 Views
Generic resolution does not distinguish based on subroutine/function alone. I tried an example with a subroutine and function both with the same argument list and CVF did complain. Can you attach an example showing the problem?
0 Kudos
cfrieler
Beginner
861 Views
Not very easily, since there are at least four files necessary. Interestingly, I tried to create the smallest possible example of the problem and on it I get a error complaining " Error: The type/rank/keyword signature for this specific procedure matches another specific procedure that shares the same generic-name."
That is what I would have expected for consistency, but leaves the question why the compiler can't use context (assignment) as part of the "signature".

I'm going to zip up the full module and include files so you can try it.
0 Kudos
Reply