http://d.puremagic.com/issues/show_bug.cgi?id=8307

           Summary: inconsistent treatment of auto functions
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: timon.g...@gmx.ch


--- Comment #0 from timon.g...@gmx.ch 2012-06-27 04:56:58 PDT ---
function.html states:
"Auto Functions

Auto functions have their return type inferred from any ReturnStatements in the
function body.

An auto function is declared without a return type. If it does not already have
a storage class, use the auto storage class.

If there are multiple ReturnStatements, the types of them must match exactly.
If there are no ReturnStatements, the return type is inferred to be void. "

DMD sez:

auto foo(){ return 0; return 0.0; } // ok

auto bar(int x){ if(x==0) return 0; return bar(x-1)+1; } // error

The compiler, the documentation or both need to be fixed.

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

Reply via email to