http://d.puremagic.com/issues/show_bug.cgi?id=5041
Summary: Cannot check functor in template constraint Product: D Version: D2 Platform: All OS/Version: All Status: NEW Keywords: rejects-valid Severity: minor Priority: P2 Component: DMD AssignedTo: nob...@puremagic.com ReportedBy: rsi...@gmail.com --- Comment #0 from Shin Fujishiro <rsi...@gmail.com> 2010-10-11 15:10:39 PDT --- DMD rejects accessing to a symbol of a function object passed via template alias parameter in template constraints. -------------------- void main() { Fun fun; test!fun(); } struct Fun { int opCall() { return 0; } } void test(alias fun)() if (is(int == typeof(fun()))) // (13) { fun(); } -------------------- % dmd -o- -c test.d test.d(13): Error: function test.test(alias fun) if (is(int == typeof(fun()))).test cannot access frame of function D main test.d(13): Error: function test.test(alias fun) if (is(int == typeof(fun()))).test cannot access frame of function D main test.d(13): Error: function test.test(alias fun) if (is(int == typeof(fun()))).test cannot access frame of function D main test.d(13): Error: function test.test(alias fun) if (is(int == typeof(fun()))).test cannot access frame of function D main -------------------- Passing functor symbols via template alias parameters should be valid like nested functions (see discussion in bug 3051), and actually, it works fine modulo the reported problem. It's a problem of template constraints. -------------------- void main() { Fun fun; test!fun(); assert(fun.value == 123); // okay, passes } struct Fun { int value; void opCall(int a) { value = a; } } void test(alias fun)() { fun(123); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------