← Back to index
|
Original Bugzilla link
Bug 7721 – Nested template loses context when mixin'd
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-03-18T05:01:50Z
Last change time
2020-02-07T12:30:57Z
Assigned to
No Owner
Creator
Simen Kjaeraas
Comments
Comment #0
by simen.kjaras — 2012-03-18T05:01:50Z
module baz; template Foo(alias T) { mixin T.Baz!(); } template Bar(U) { template Baz( ) { U n; } } void main( ) { mixin Foo!(Bar!int); } Yields the error messages: baz.d(9): Error: undefined identifier U, did you mean variable n? baz.d(4): Error: mixin baz.main.Foo!(__T3BarTiZ).Baz!() error instantiating baz.d(14): Error: mixin baz.main.Foo!(__T3BarTiZ) error instantiating
Comment #1
by simen.kjaras — 2018-02-13T09:02:01Z
Simplified example showing template template parameters are unnecessary to trigger this bug: template Bar(T) { template Baz() { T n; } } unittest { // Works. Bar!int.Baz!().n = 3; // Fails: foo.d(3): Error: undefined identifier T mixin Bar!int.Baz!(); }
Comment #2
by simen.kjaras — 2020-02-07T12:30:57Z
Fixed in 2.087.1.