[Issue 12237] New: Inconsistent behavior of the instantiating enclosing template function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Feb 23 23:42:33 PST 2014
https://d.puremagic.com/issues/show_bug.cgi?id=12237
Summary: Inconsistent behavior of the instantiating enclosing
template function
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: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2014-02-23 23:42:30 PST ---
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)
--
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list