Bug 9026 – Template mixin identifier as template alias parameter doesn't work
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-11-14T21:13:00Z
Last change time
2012-12-28T23:39:37Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2012-11-14T21:13:35Z
From the digitalmars.d.learn forum:
http://forum.dlang.org/thread/[email protected]
Code:
---
mixin template node() {
static if (is(this == struct))
alias typeof(this)* E;
else
alias typeof(this) E; //Line5
E prev, next;
}
struct list(alias N) {
N.E head;
N.E tail;
}
class A {
mixin node L1; //Line13
mixin node L2; //Line14
}
list!(A.L1) l1; //Line16
list!(A.L2) l2; //Line17
---
Output:
---
test.d(5): Error: this is not in a class or struct scope
test.d(5): Error: 'this' is only defined in non-static member functions, not node!()
test.d(13): Error: mixin test.node!() error instantiating
test.d(16): Error: list!(L1) is used as a type
test.d(5): Error: this is not in a class or struct scope
test.d(5): Error: 'this' is only defined in non-static member functions, not node!()
test.d(14): Error: mixin test.node!() error instantiating
test.d(17): Error: list!(L2) is used as a type
---