digitalmars.D.bugs - [Issue 19582] New: Make core.internal.convert.toUbyte in CTFE for
- d-bugmail puremagic.com (39/39) Jan 14 2019 https://issues.dlang.org/show_bug.cgi?id=19582
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); }(); --- --
Jan 14 2019