Bug 471 – Protection attributes of mixin instances are applied in a wrong scope.
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P4
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-10-31T07:59:00Z
Last change time
2014-02-15T13:22:04Z
Keywords
rejects-valid, spec
Assigned to
bugzilla
Creator
bruno.do.medeiros+deebugz
Comments
Comment #0 by bruno.do.medeiros+deebugz — 2006-10-31T07:59:09Z
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.