digitalmars.D.bugs - [Issue 21035] New: wrong code when uses struct's methods of .init
- d-bugmail puremagic.com (37/37) Jul 10 2020 https://issues.dlang.org/show_bug.cgi?id=21035
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 --
Jul 10 2020