www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 11556] New: named nested functions in templates are not infered

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

           Summary: named nested functions in templates are not infered
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: monarchdodra gmail.com



IS this known? I couldn't find it. Anyways, I think this is supposed to work (I
*thought* it worked...):

//----
void foo(T)(T t)
{
    void bar()
    {}
    bar();
}

void main()  safe pure nothrow
{
    foo(5); //Derp
}
//----

Produces:
//----
Error: safe function 'D main' cannot call system function 'hello.foo!int.foo'
Error: 'hello.foo!int.foo' is not nothrow
Error: function 'D main' is nothrow yet may throw
//----

EG: In this context, "bar" is not infered, which makes it so that "foo" is not
inferred either. I think this is wrong.

What is strange is that if the function call is a lambda, then everything is
fine:

//----
void foo(T)(T t) 
{
    (){}();
}

void main()  safe pure nothrow
{
    foo(5); //OK!
}
//----

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


monarchdodra gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 10329 ***

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