Thread overview | ||||||
---|---|---|---|---|---|---|
|
June 21, 2020 [Issue 20968] Linker error of uninstantiated templated `opEquals` member of struct when compiled with -preview=in | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20968 --- Comment #1 from Per Nordlöw <per.nordlow@gmail.com> --- Same linker error is triggered when replacing `opEquals` with `opCmp` as with Rational!(I1) rational(I1, I2)(I1 , I2) { return typeof(return)(); } struct Rational(Int) { bool opCmp(Rhs)(Rhs _) {} } @nogc unittest { auto _ = rational(1, 2); } instead fails to link as rational.o:__main.d:_D36TypeInfo_S8rational__T8RationalTiZQm6__initZ: error: undefined reference to '_D6object7_xopCmpFMxPvMxQeZb' -- |
June 22, 2020 [Issue 20968] Linker error of uninstantiated templated `opEquals` member of struct when compiled with -preview=in | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20968 Boris Carvajal <boris2.9@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |boris2.9@gmail.com --- Comment #2 from Boris Carvajal <boris2.9@gmail.com> --- Just quoting forum's reply https://forum.dlang.org/thread/mftygusieubpaoobyogx@forum.dlang.org 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. -- |
June 22, 2020 [Issue 20968] Linker error of uninstantiated templated `opEquals` member of struct when compiled with -preview=in | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20968 FeepingCreature <default_357-line@yahoo.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |default_357-line@yahoo.de --- Comment #3 from FeepingCreature <default_357-line@yahoo.de> --- May relate to https://issues.dlang.org/show_bug.cgi?id=19091 - sometimes the compiler doesn't notice misinstantiation of structs. Then the failed struct is cached for the template parameter and treated as successful. -- |
December 17, 2022 [Issue 20968] Linker error of uninstantiated templated `opEquals` member of struct when compiled with -preview=in | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20968 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P1 |P3 -- |
Copyright © 1999-2021 by the D Language Foundation