The intent here is to agressively prevent people from using struct that is only meant as a namespace and thus contains only static methods & opCall/opDispatch etc. The sample below with fine on Win32 but fails to link on Linux 64-bit: public struct dummy { static auto opCall(C)(in C[] name) { return name; } @disable ~this(); //comment this out to avoid error } void main() { assert(dummy("ABCDE") == "ABCDE"); } The error message is: test_case.o:(.data._D26TypeInfo_S9test_case5dummy6__initZ+0x58): undefined reference to `_D9test_case5dummy6__dtorMFZv' That is the destructor symbol is not found - correct it shouldn't been there, but apparently it's referenced all the same.
Shouldn't we just emit a null pointer into the struct TypeInfo for disabled dtors?
(In reply to comment #1) > Shouldn't we just emit a null pointer into the struct TypeInfo for disabled > dtors? I do think it's the same as @disable this(); i.e. changes semantics so that you literally can't call destructor even statically. And on win32 I'm seeing just that.
@Geod24 updated dlang/dmd pull request #14272 "Fix 18973 - TypeInfo generation does not account for `@disable`" fixing this issue: - Fix 9161 - Linker error if struct has disabled dtor https://github.com/dlang/dmd/pull/14272
dlang/dmd pull request #14272 "Fix 18973, 9161 - TypeInfo generation does not account for `@disable`" was merged into master: - 4df133b57411383be4721685f594ff8ab193f56d by Geod24: Fix 9161 - Linker error if struct has disabled dtor https://github.com/dlang/dmd/pull/14272