https://issues.dlang.org/show_bug.cgi?id=19568
Issue ID: 19568 Summary: hashOf should not unnecessarily call a struct's fields' postblits & dtors in CTFE Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nob...@puremagic.com Reporter: n8sh.second...@hotmail.com Example of code that doesn't work because a CTFE-only path in hashOf unnecessarily calls an impure destructor and tries to call a disabled postblit: --- void main() { static struct S1 { @disable this(this); ~this() @nogc nothrow { import core.stdc.stdio; if (mptr) puts("impure"); } size_t[2] pad; void* mptr; } static struct S2 { @disable this(this); ~this() @nogc nothrow { import core.stdc.stdio; if (fd != -1) puts("impure"); } int fd = -1; S1 s1; } static struct S3 { private S2 s2; } S3 s3; size_t h = ((ref S3 s3) pure => hashOf(s3))(s3); } --- --