[Issue 471] New: Protection attributes of mixin instances are applied in a wrong scope.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Oct 31 05:59:11 PST 2006


http://d.puremagic.com/issues/show_bug.cgi?id=471

           Summary: Protection attributes of mixin instances are applied in
                    a wrong scope.
           Product: D
           Version: 0.173
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid, spec
          Severity: normal
          Priority: P4
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: brunodomedeiros+bugz at gmail.com


Protection attributes of mixin instances are applied in a wrong scope.
The following illustrates it:
---- baz.d ----
module baz;

template Baz() {
    private void privfunc(){ }
}
---- ----
import baz;

class Foo {
    mixin Baz!();  

    void testfunc() {
        privfunc(); // Error: .privfunc is private
    }
}
---- ----
For reference the spec states (http://www.digitalmars.com/d/mixin.html):
"Unlike a template instantiation, a template mixin's body is evaluated within
the scope where the mixin appears, not where the template declaration is
defined. It is analogous to cutting and pasting the body of the template into
the location of the mixin."
If the current compiler behavior is the intended behavior then fix the spec.


-- 




More information about the Digitalmars-d-bugs mailing list