[Issue 9026] New: Template mixin identifier as template alias parameter doesn't work

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 14 21:13:41 PST 2012


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

           Summary: Template mixin identifier as template alias parameter
                    doesn't work
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2012-11-14 21:13:35 PST ---
>From the digitalmars.d.learn forum:
http://forum.dlang.org/thread/xftbyifuuubxhhsolgpv@forum.dlang.org

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
---

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list