[Issue 19030] New: CTorFlow checking is too aggressive and only checks whether a this call is present
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 27 09:17:31 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19030
Issue ID: 19030
Summary: CTorFlow checking is too aggressive and only checks
whether a this call is present
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: greensunny12 at gmail.com
https://issues.dlang.org/show_bug.cgi?id=18719 introduced a regression as it
only checks whether a this() call is present, but not what the this call
actually does.
For example, this slightly modified example from 18719 no produces an error
even though it sets x only once:
---
struct S
{
int x = -1;
this(int y) immutable
{
x = y;
import std.stdio;
writeln("Ctor called with ", y);
}
void opAssign(int) immutable;
}
class C
{
S x;
this() immutable
{
this(42); /* Initializes x. */
x = 13; /* Breaking immutable, or ok? */
}
this(int x) immutable
{
}
}
---
--
More information about the Digitalmars-d-bugs
mailing list