[Issue 14747] New: compiler insists on unnecessary return statement

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jun 29 03:33:42 PDT 2015


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

          Issue ID: 14747
           Summary: compiler insists on unnecessary return statement
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: john.loughran.colvin at gmail.com

//returns.d
auto foo(Args...)()
{
    foreach(arg; Args)
        static if(is(arg == int))
        {
            return 0;
        }
}

void main()
{
    foo!int;
}

$ dmd results.d
returns.d(1): Error: function returns.foo!int.foo no return exp; or assert(0);
at end of function
returns.d(12): Error: template instance returns.foo!int error instantiating

--


More information about the Digitalmars-d-bugs mailing list