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)