[Issue 930] New: Templates inside templates used as mixins

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Feb 3 23:13:50 PST 2007


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

           Summary: Templates inside templates used as mixins
           Product: D
           Version: 1.004
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: wbaxter at gmail.com


The following should work I believe, but apparently the type from the outer
template does not get propagated to the inner template.
It does work if the 'T' line is removed.

----
template ATemplate(T) {
   template ATemplate() {
       void foo() {
           T x = 2; // this line causes an error
           printf("Hi\n");
       }
   }
}

class TheClass(alias MixIt)
{
    mixin MixIt;
}


void main() {
    auto val = new TheClass!(ATemplate!(int));
    val.foo();

}


-- 



More information about the Digitalmars-d-bugs mailing list