Bug 11556 – named nested functions in templates are not infered
Status
RESOLVED
Resolution
DUPLICATE
Severity
critical
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-11-19T12:11:00Z
Last change time
2015-06-09T01:31:15Z
Assigned to
nobody
Creator
monarchdodra
Comments
Comment #0 by monarchdodra — 2013-11-19T12:11:56Z
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!
}
//----
Comment #1 by monarchdodra — 2013-11-19T23:09:08Z
*** This issue has been marked as a duplicate of issue 10329 ***