[Issue 5867] New: Cannot put function attributes (const, pure, ...) on the right of an auto-return function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Apr 20 12:05:44 PDT 2011


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

           Summary: Cannot put function attributes (const, pure, ...) on
                    the right of an auto-return function
           Product: D
           Version: D2
          Platform: Other
        OS/Version: Mac OS X
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: kennytm at gmail.com


--- Comment #0 from kennytm at gmail.com 2011-04-20 12:02:05 PDT ---
Test case:

-------------------------
auto f() pure {
    return 4;
}
void main() {
    assert(f() == 4);
}
-------------------------

As of 2.052 it raises the errors

x.d(1): function declaration without return type. (Note that constructors are
always named 'this')
x.d(1): no identifier for declarator pure f()

The error will not happen if the attribute 'pure' is put at the front (pure
auto f() { ... }) or the exact return type is provided (int f() pure { ... }).

Possibly the same issue as bug 4785.

-- 
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