[Issue 18973] @disable on const toHash causes unresolved symbol error
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat May 9 21:28:09 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=18973
--- Comment #3 from LucienPe <lucien.perregaux at gmail.com> ---
(In reply to elpenguino+D from comment #2)
> Incorrect. a @disabled method does not need a body, as no references to it
> are ever emitted. You can observe this for yourself by simply renaming
> toHash in the example to something without special semantics. Or by removing
> const. Even a non- at disable'd method without a body doesn't generate linker
> errors unless you try to call it.
You're right. That was a workaround :P
This bug is also valid for `toString()`.
```
struct Foo
{
@disable size_t toHash() const nothrow @safe; // linker fail
@disable size_t toHash(); // ok
@disable string toString(); // linker fail
}
class Bar
{
@disable override size_t toHash() const nothrow @safe; // linker fail
@disable override size_t toHash(); // linker fail
@disable override string toString(); // linker fail
}
```
--
More information about the Digitalmars-d-bugs
mailing list