dub test errors during linking for struct with uninstantiated templated opEquals

Boris Carvajal boris2.9 at gmail.com
Mon Jun 22 09:38:46 UTC 2020


On Sunday, 21 June 2020 at 22:48:20 UTC, Per Nordlöw wrote:
> On Sunday, 21 June 2020 at 17:05:11 UTC, kinke wrote:
>> Please file an issue.
>
> Done: https://issues.dlang.org/show_bug.cgi?id=20968

You can get more info compiling with "-verrors=spec"

"(spec:1) Error: template rational.Rational!int.Rational.opEquals 
cannot deduce function from argument types 
!()(const(Rational!int)) const, candidates are:"

 From reading the docs for function opEquals 
(https://dlang.org/spec/operatoroverloading.html#equals).
It shows a templated version with a const modifier.
If you change the function signature to:

bool opEquals(Rhs)(Rhs _) const {return true;} // Note the 
'const', and putting some return back because dustmite removed it

The program links fine.

So it seems a compiler error is gagged that should be exposed and 
also could be improved.


More information about the Digitalmars-d mailing list