Thread overview |
---|
May 09, 2020 [Issue 18973] @disable on const toHash causes unresolved symbol error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18973 LucienPe <lucien.perregaux@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |lucien.perregaux@gmail.com Resolution|--- |INVALID --- Comment #1 from LucienPe <lucien.perregaux@gmail.com> --- That has nothing to do with the @disable attribute. It's because you need to add a body to `toHash()`. Like this: ``` @disable size_t toHash() const { return 0; } ``` For the v2.091 of DMD: ``` struct X { @disable size_t toHash() const nothrow @safe { return 0; } } ``` -- |
May 09, 2020 [Issue 18973] @disable on const toHash causes unresolved symbol error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18973 elpenguino+D@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|INVALID |--- --- Comment #2 from elpenguino+D@gmail.com --- 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-@disable'd method without a body doesn't generate linker errors unless you try to call it. -- |
May 09, 2020 [Issue 18973] @disable on const toHash causes unresolved symbol error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18973 --- Comment #3 from LucienPe <lucien.perregaux@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-@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 } ``` -- |
May 09, 2020 [Issue 18973] @disable on const toHash causes unresolved symbol error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18973 LucienPe <lucien.perregaux@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |link-failure, rejects-valid -- |
July 07, 2022 [Issue 18973] @disable on const toHash causes unresolved symbol error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18973 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> --- @Geod24 created dlang/dmd pull request #14272 "Fix 18973 - TypeInfo generation does not account for `@disable`" fixing this issue: - Fix 18973 - TypeInfo generation does not account for `@disable` This changes `overloadExactMatch` as all 14 usages of it are to find functions that can later be called. https://github.com/dlang/dmd/pull/14272 -- |
July 07, 2022 [Issue 18973] @disable on const toHash causes unresolved symbol error | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=18973 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|REOPENED |RESOLVED Resolution|--- |FIXED --- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/dmd pull request #14272 "Fix 18973, 9161 - TypeInfo generation does not account for `@disable`" was merged into master: - 22e4aecb13b7020cbc4525e6eb0a4d77b7528d74 by Geod24: Fix 18973 - TypeInfo generation does not account for `@disable` This changes `overloadExactMatch` as all 14 usages of it are to find functions that can later be called. https://github.com/dlang/dmd/pull/14272 -- |
Copyright © 1999-2021 by the D Language Foundation