www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 12410] New: non-parametrized helper function in eponymous template is not inferred

reply d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12410

           Summary: non-parametrized helper function in eponymous template
                    is not inferred
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: monarchdodra gmail.com



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!
}
//----

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 19 2014
parent d-bugmail puremagic.com writes:
https://d.puremagic.com/issues/show_bug.cgi?id=12410




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.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 19 2014