Bug 21908 – protected struct static opCall from mixin template not available from child class

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-05-08T13:07:54Z
Last change time
2024-12-13T19:16:18Z
Assigned to
No Owner
Creator
Adam D. Ruppe
Moved to GitHub: dmd#18033 →

Comments

Comment #0 by destructionator — 2021-05-08T13:07:54Z
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.
Comment #1 by robert.schadek — 2024-12-13T19:16:18Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/18033 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB