August 02, 2006
http://d.puremagic.com/issues/show_bug.cgi?id=275

           Summary: Undefined identifier in instances of templates with
                    forward mixins
           Product: D
           Version: 0.163
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: daiphoenix@lycos.com


Undefined identifier in instances of templates with forward mixins. The following fails to compile:

----
template TplWithMixin() {
        mixin Mnum!();
}

//Error: undefined identifier TplWithMixin!().cnum :
auto a = TplWithMixin!().cnum;

template Mnum() {
        const int cnum = 2;
}
----

If TplWithMixin!().cnum is accessed only inside a function, then no error
occurs.
But if an instance of TplWithMixin is made outside a function, and before the
mixin template, then the function instances will also fail when accessing
members. This code exemplifies:

-----
template TplWithMixin() {
        mixin Mnum!();
}

void test() {
        //Error: undefined identifier TplWithMixin!().cnum :
        auto a = TplWithMixin!().cnum;
}

// Compiles ok if this line is removed or placed after Mnum :
alias TplWithMixin!() xxx;

template Mnum() {
        const int cnum = 2;
}
----


-- 

November 26, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=275


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |bugzilla@digitalmars.com


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