July 11, 2020 [Issue 21035] New: wrong code when uses struct's methods of .init value | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21035 Issue ID: 21035 Summary: wrong code when uses struct's methods of .init value Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: critical Priority: P1 Component: dmd Assignee: nobody@puremagic.com Reporter: ilyayaroshenko@gmail.com struct CNB { string _separator = "-"; char[64] data = '\0'; /// @disable this(this); @safe pure @nogc: /// ref CNB append(scope const(char)[] str) scope return { data[0 .. str.length] = str; return this; } } extern(C) void main() { auto id = CNB .init .append("USD.LIBOR.1D") .data; } $ dmd -inline -betterC -run test.d -betterC is optional -- |
Copyright © 1999-2021 by the D Language Foundation