Bug 12237 – Inconsistent behavior of the instantiating enclosing template function

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-02-23T23:42:00Z
Last change time
2014-05-14T11:45:20Z
Keywords
pull, rejects-valid
Assigned to
nobody
Creator
k.hara.pg

Comments

Comment #0 by k.hara.pg — 2014-02-23T23:42:30Z
In the case, func is a template function, and (a) { ... } is a template lambda (== template function). So the both should work as same. auto func(T)(T) { static if (is(T == int)) return func(""); else return 10; } void main() { assert(func(1) == 10); assert((a) { static if (is(typeof(a) == int)) { int x; return __traits(parent, x)(""); // line 17 } else return 10; } (1) == 10); } --- test.d(17)Error: function literal __lambda1 (int a) is not callable using argument types (string)
Comment #1 by k.hara.pg — 2014-03-09T21:22:08Z
Comment #2 by github-bugzilla — 2014-05-14T11:45:19Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5dc529c2a17f34893167abd48c9bf18bcd2e4247 fix Issue 12237 - Inconsistent behavior of the instantiating enclosing template function https://github.com/D-Programming-Language/dmd/commit/f32b823abcc5ec6fb687956bf739c488ac2b0bf5 Merge pull request #3370 from 9rnsr/fix_lambda Issue 12235 & 12236 & 12237 - fix issues around lambda