[Issue 12791] New: .tupleof does not take base class fields into account
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri May 23 08:51:28 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12791
Issue ID: 12791
Summary: .tupleof does not take base class fields into account
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: andrej.mitrovich at gmail.com
-----
class A
{
int a;
}
class B : A
{
int b;
B clone()
{
auto b = new B;
b.tupleof = this.tupleof;
return b;
}
}
void main()
{
auto b = new B;
b.a = 10;
b.b = 20;
auto clone = b.clone();
assert(clone.b == 20);
assert(clone.a == 10); // fails, it's 0
}
-----
Since working with .tupleof is a fairly new and experimental feature I think
the above could be labeled an enhancement request.
--
More information about the Digitalmars-d-bugs
mailing list