[Issue 11427] New: anonymous unions break structs in @safe code
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Nov 3 01:52:19 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11427
Summary: anonymous unions break structs in @safe code
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: r.sagitario at gmx.de
--- Comment #0 from Rainer Schuetze <r.sagitario at gmx.de> 2013-11-03 01:52:10 PST ---
Compile this code
///////////////////
struct S
{
union
{
ubyte a;
int x;
}
void[] arr;
}
int foo() @safe
{
S s1 = S();
S s2;
return 0;
}
////////////////////
with "dmd -c test.d" fails with
test.d(14): Error: variable test.foo.s2 unions containing pointers are not
allowed in @safe functions
Please note that the first variable s1 is ok!
This is also triggered in std.format with this code:
import std.format;
import std.array;
void foo()
{
FormatSpec!char spec = FormatSpec!char();
auto s = appender!string;
formattedWrite(s, "%s", "hello");
}
--
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