[Issue 19430] New: wrong code for `this =`
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Nov 24 12:59:29 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19430
Issue ID: 19430
Summary: wrong code for `this =`
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: critical
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: ilyayaroshenko at gmail.com
import core.atomic;
import core.stdc.stdio;
struct S
{
int i;
this(int i)
{
this.i = i;
puts("c");
}
this(this)
{
puts("p");
}
~this()
{
puts("d");
}
this(int r, int e)
{
this = sum(r, e);
}
static S sum(int r, int e)
{
return S(r + e);
}
}
void main()
{
auto c = S(1, 2);
}
output:
=================
c
d
d
=================
0 - postblits, 1 - constructor, 2 destructors
--
More information about the Digitalmars-d-bugs
mailing list