Bug 1179 – Compiler doesn't complain about function redefinition when using template mixin

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D1 (retired)
Platform
x86
OS
All
Creation time
2007-04-23T07:29:00Z
Last change time
2014-02-16T15:24:06Z
Assigned to
bugzilla
Creator
aarti

Comments

Comment #0 by aarti — 2007-04-23T07:29:55Z
import std.stdio; template t(T) { int policy() { return 1; } } class C { mixin t!(C); int policy() { return 2; } } void main() { writefln((new C).policy); }
Comment #1 by bugzilla — 2007-04-23T14:04:34Z
This is the way its supposed to work. Each mixin gets its own namespace, so that names can match names in the non-mixin declarations and other mixin declarations. You can access those conflicting names by using the mixin name as a scope operator.
Comment #2 by aarti — 2007-04-24T02:55:24Z