[Issue 11556] New: named nested functions in templates are not infered

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 19 12:11:57 PST 2013


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 at puremagic.com
        ReportedBy: monarchdodra at gmail.com


--- Comment #0 from monarchdodra at gmail.com 2013-11-19 12:11:56 PST ---
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: -------


More information about the Digitalmars-d-bugs mailing list