Bug 12410 – non-parametrized helper function in eponymous template is not inferred
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-03-19T01:36:00Z
Last change time
2014-04-18T06:48:49Z
Assigned to
nobody
Creator
monarchdodra
Comments
Comment #0 by monarchdodra — 2014-03-19T01:36:26Z
Given:
- An eponymous template
- A non-parametrized function
- That is not eponymous
=> inference is not triggered
//----
template sift1(T)
{
void sift1() //Infered
{}
}
template sift2(T)
{
void siftImpl() //*NOT* infered
{}
void sift2() //Infered
{
siftImpl();
}
}
void main() @safe pure nothrow
{
sift1!int(); //OK!
sift2!int(); //FAILS!
}
//----
Comment #1 by monarchdodra — 2014-03-19T02:01:14Z
Actually, it's a bit simpler than that. All it takes is being non eponymous:
template sift(T)
{
void impl() //Not infered
{}
}
void main() @safe pure nothrow
{
sift!int.impl(); //Fails
}
Not sure if bug or enhancement, but I think this should work: "impl" depends on T.
Comment #2 by k.hara.pg — 2014-04-18T06:48:49Z
This is a dup of 12265. See my comment in its comment#1.
*** This issue has been marked as a duplicate of issue 12265 ***