Disabling opAssign in a type disabled all the opAssigns of an aliased type?
Simen Kjærås
simen.kjaras at gmail.com
Wed Aug 1 06:05:09 UTC 2018
On Tuesday, 31 July 2018 at 20:40:25 UTC, Steven Schveighoffer
wrote:
> OK, so one thing to learn in D, you can't hijack stuff. When
> you override a function, you have to override ALL the overloads.
I could have sworn I tested this before I wrote that it's a bug:
struct A {
void fun(int) {}
}
struct B {
A a;
alias a this;
@disable void fun(float);
}
void main() {
B b;
b.fun(3);
}
I was surprised to see it work, as I also thought it'd be a
hijacking issue. Turns out, it doesn't actually work. I must have
made a typo when I tried it. Ah well.
--
Simen
More information about the Digitalmars-d-learn
mailing list