Summary: template instance cannot use argument from enclosing
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Trass3r <> 2011-07-14 04:16:39 PDT ---
extern(C) void printf(const char*, ...);
void h() { printf("h()"); }

class Bla
    mixin wrap!h;

mixin template wrap(alias f)
    void blub(alias g = f)()

void main()
    Bla b = new Bla();

$ dmd -c nonlocaltemplate.d 
nonlocaltemplate.d(20): Error: template instance cannot use local 'f' as
parameter to non-global template blub(alias g = f)
nonlocaltemplate.d(20): Error: template instance forward reference of f
nonlocaltemplate.d(20): Error: template instance
nonlocaltemplate.Bla.wrap!(h).blub!(f) error instantiating

Note that imho this is different from because here the argument is
not on the stack but it's a template argument (and thus a compile-time value)

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to