[Issue 21908] New: protected struct static opCall from mixin template not available from child class
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat May 8 13:07:54 UTC 2021
https://issues.dlang.org/show_bug.cgi?id=21908
Issue ID: 21908
Summary: protected struct static opCall from mixin template not
available from child class
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: destructionator at gmail.com
file mix2.d:
---
class C {
mixin Signal foo;
protected struct protstruct {}
}
mixin template Signal() {
final:
protected struct emit {
static void opCall() {}
};
public struct connect {
static void opCall() {}
};
}
---
file mix.d:
---
import mix2;
void main() {
auto d = new D;
//d.foo.emit(); // correctly hidden because it is protected (though the
error message is not great, it isn't wrong)
d.foo.connect(); // it is public so this works
d.bar.emit(); // this is ok because it our same module
d.bar.connect(); // again public so we're ok
//C.protstruct not_available; // correctly hidden because it is
protected
}
class D : C {
this() {
// no trouble off the one here
bar.emit();
bar.connect();
protstruct available; // protected works just fine as it should
foo.emit actually_works; // the symbol isn't just hidden...
foo.connect(); // public off the other one works ok
// and BUG here
foo.emit(); // but the protected one is not letting me call it
}
mixin Signal bar;
}
---
That foo.emit should be the same as the protstruct, but instead it says:
mix.d(27): Error: no property `emit` for type `void`
It shouldn't be saying "type void" at all, making me pretty sure this is a bug.
And it works if i do the static opCall thing on protstruct too - surely the
mixin template should behave the same way.
--
More information about the Digitalmars-d-bugs
mailing list