[Issue 21419] New: Spurious "forward reference to inferred return type of function call" with recursive template functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Nov 24 05:39:53 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21419

          Issue ID: 21419
           Summary: Spurious "forward reference to inferred return type of
                    function call" with recursive template functions
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dlang-bugzilla at thecybershadow.net

/////////////////////////// test.d //////////////////////////
auto fun(int x)()
{
    gun();
}

void gun()()
{
    fun!2();
}

unittest
{
//  fun!1(); // Uncomment to fix below instantiation
    fun!2(); // forward reference to inferred return type ...
}
/////////////////////////////////////////////////////////////

Similar to issue 10810. However, there is evidence that this is just a dirty
compiler bug instead of some intrinsic design limitation: explicitly
instantiating the template with a parameter different from the one used in the
recursive call causes the recursive instantiation to succeed (causing "spooky
action at a distance").

--


More information about the Digitalmars-d-bugs mailing list