January 14, 2019 [Issue 19582] New: Make core.internal.convert.toUbyte in CTFE for arrays work with reference type elements and not call postblits/dtors | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=19582 Issue ID: 19582 Summary: Make core.internal.convert.toUbyte in CTFE for arrays work with reference type elements and not call postblits/dtors Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nobody@puremagic.com Reporter: n8sh.secondary@hotmail.com Make `core.internal.convert.toUbyte` in CTFE for arrays work with reference type elements and not call postblits/dtors. This is necessary for the CTFE path of `hashOf` in some circumstances. Example currently non-compiling code: --- import core.internal.convert : toUbyte; final static class C : Object {} enum b1 = (() @nogc nothrow pure @safe { C[10] o; return toUbyte(o[])[0]; })(); static struct S { int x; @disable this(this); ~this() @nogc nothrow { import core.stdc.stdio : puts; if (x) puts("impure"); } } enum b2 = () { S[10] a; return ((const S[] a) @nogc nothrow pure @safe => toUbyte(a))(a); }(); --- -- |
Copyright © 1999-2021 by the D Language Foundation