digitalmars.D.bugs - [Issue 20025] New: alias this combined with a copy constructor seems
- d-bugmail puremagic.com (34/34) Jul 04 2019 https://issues.dlang.org/show_bug.cgi?id=20025
https://issues.dlang.org/show_bug.cgi?id=20025 Issue ID: 20025 Summary: alias this combined with a copy constructor seems to lead to undefined behaviour. Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: big.friendian gmail.com Running the following code prints a random integer every time. If the copy constructor is removed, the code functions as expected (prints '77'). import std.stdio; struct B { static int value = 77; alias value this; this(ref return scope inout B rhs) inout { } } void test(int x) { writefln("x: %s", x); } int main() { B b; test(b); return 0; } --
Jul 04 2019