[Issue 8307] New: inconsistent treatment of auto functions

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jun 27 04:54:29 PDT 2012


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: nobody at puremagic.com
        ReportedBy: timon.gehr at gmx.ch


--- Comment #0 from timon.gehr at 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: -------


More information about the Digitalmars-d-bugs mailing list