[Issue 21035] New: wrong code when uses struct's methods of .init value
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jul 11 03:01:56 UTC 2020
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 at puremagic.com
Reporter: ilyayaroshenko at 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
--
More information about the Digitalmars-d-bugs
mailing list