[Issue 10266] New: CTFE: Allow reinterpret casts T <-> T[1]
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jun 4 08:54:44 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10266
Summary: CTFE: Allow reinterpret casts T <-> T[1]
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: CTFE
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: verylonglogin.reg at gmail.com
--- Comment #0 from Denis Shelomovskij <verylonglogin.reg at gmail.com> 2013-06-04 19:54:43 MSD ---
This is necessary if you don't want to branch a templated function in static
array case and just treat everything as a flat static array (i.e. both T and
T[1][1] become T[1]):
---
ref f(ref int i)
{
return *cast(int[1]*) &i;
}
void g()
{
int i;
f(i)[0] = 5;
assert(i == 5);
}
static assert((g(), true));
---
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list