[Issue 19582] New: Make core.internal.convert.toUbyte in CTFE for arrays work with reference type elements and not call postblits/dtors
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jan 14 09:13:06 UTC 2019
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 at puremagic.com
Reporter: n8sh.secondary at 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);
}();
---
--
More information about the Digitalmars-d-bugs
mailing list