[Issue 18707] New: Destructor of qualified objects not typechecked properly
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Apr 2 14:33:47 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18707
Issue ID: 18707
Summary: Destructor of qualified objects not typechecked
properly
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: andrei at erdani.com
Consider:
int[] sneaky;
struct A
{
private int[] innocent;
~this()
{
sneaky = innocent;
}
}
void main()
{
immutable a = A([1, 2, 3]);
{
auto b = a;
}
sneaky[1] = 42; // oops
import std.stdio;
writeln(a.innocent); // ooooops
}
The destructor should not unqualify the structure, or should in limited ways.
--
More information about the Digitalmars-d-bugs
mailing list