digitalmars.D.bugs - [Issue 11645] New: struct with union considered unsafe only in second struct literal
- d-bugmail puremagic.com (46/46) Nov 30 2013 https://d.puremagic.com/issues/show_bug.cgi?id=11645
https://d.puremagic.com/issues/show_bug.cgi?id=11645 Summary: struct with union considered unsafe only in second struct literal Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: accepts-invalid Severity: normal Priority: P2 Component: DMD AssignedTo: nobody puremagic.com ReportedBy: r.sagitario gmx.de PST --- Compiling: /////////////// struct S { union { int[] a; int[] b; } } void foo()() { S s1 = S(); S s2 = S(); // line 19: compiles without this line } void main() safe { foo(); } /////////////// yields: test2.d(19): Error: safe function 'D main' cannot call system function 'test2.foo!().foo' Please note, that the error does not happen with only s1 being declared. std.regex makes use of the buggy behaviour, otherwise std.regex.replace would not infer as safe because struct Captures contains a similar union. Note: https://github.com/D-Programming-Language/dmd/pull/2480 contains a fix for this, but causes the unittests of std.regex to fail. -- Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Nov 30 2013