[Issue 4976] New: Can't use auto on const member functions.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Oct 2 17:26:47 PDT 2010


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

           Summary: Can't use auto on const member functions.
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: peter.alexander.au at gmail.com


--- Comment #0 from Peter Alexander <peter.alexander.au at gmail.com> 2010-10-02 17:26:27 PDT ---
When you try to use type inference on a const member function, you get a
compiler error:

class Foo
{
public:
    auto foo() const { return 0; }    
}

Compiling gives:

test.d(4): no identifier for declarator foo
test.d(4): semicolon expected, not 'const'
test.d(4): Declaration expected, not 'return'

Removing the 'const' allows it to compile, but the function can no longer be
called on const objects.

The same applies for structs and @property methods.

This is using DMD 2.049.

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