digitalmars.D.bugs - [Issue 15660] New: result of pure function
- via Digitalmars-d-bugs (35/35) Feb 08 2016 https://issues.dlang.org/show_bug.cgi?id=15660
https://issues.dlang.org/show_bug.cgi?id=15660 Issue ID: 15660 Summary: result of pure function Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: iaktakh gmail.com Compiler can't determine result of pure function is not unique import std.stdio; struct S { void[] arr; // with int instead of void program doesn't compiles auto f() pure safe { int[] a = new int[4]; arr = a; return a; } } void main() safe { S s; immutable a = s.f(); int[] b = (cast(int[])s.arr); writeln(a); // [0, 0, 0, 0] b[0] = 1; writeln(a); // [1, 0, 0, 0] } --
Feb 08 2016