Closed Stack-OverFlo closed 5 years ago
Never compile the 2 fonctions test have the same prototype => bug no way to choose.
This code really compiles, and leads to a seg fault
The segfault is trivial to fix. Getting a function ambiguity
message is tougher.
When we use the commented line, we correctly have a function ambiguity
message, but when used in LinearCG
(probably with other functions), this leads to a silent segfault.
Did users really have the right to write two functions with the same prototype ? (in edp file)
You have the message because, as Frédéric said, the function is being evaluated in the .edp
. In the .cpp
, there is a missing ffassert
there https://github.com/FreeFem/FreeFem-sources/blob/master/src/fflib/lgfem.cpp#L585 (and probably in many other places).
a put a correction
10 : //real[int] v = test(u);
11 :
12 : LinearCG(test, u)
Warning ambiguity Polymorphic Find 2
( <3KN_IdE> :
Describe the bug Function ambiguity
Expected behavior Should not compile
Code
Desktop (please complete the following information):