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: nob...@puremagic.com ReportedBy: r.sagita...@gmx.de --- Comment #0 from Rainer Schuetze <r.sagita...@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: -------