[Issue 6312] New: template instance cannot use argument from enclosing template
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jul 14 04:21:53 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=6312
Summary: template instance cannot use argument from enclosing
template
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: mrmocool at gmx.de
--- Comment #0 from Trass3r <mrmocool at gmx.de> 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)()
{
g();
}
}
void main()
{
Bla b = new Bla();
b.blub();
}
$ 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
http://d.puremagic.com/issues/show_bug.cgi?id=3051 because here the argument is
not on the stack but it's a template argument (and thus a compile-time value)
--
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