[Issue 4040] New: const/immutable on the right in auto return class methods

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Apr 1 13:39:39 PDT 2010


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

           Summary: const/immutable on the right in auto return class
                    methods
           Product: D
           Version: future
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-04-01 13:39:38 PDT ---
I think in D2 the attributes like const and immutable for classes/structs (and
maybe enums too) can be moved on the right, but this program:

class Foo {
    auto bar1() const { return 0; }
    auto bar2() immutable { return 0; }
    auto bar3() shared { return 0; }
}
struct Spam {
    auto baz1() const { return 0; }
    auto baz2() immutable { return 0; }
}
void main() {}


Generates some errors (dmd 2.042):

temp.d(2): no identifier for declarator bar1
temp.d(2): semicolon expected, not 'const'
temp.d(2): Declaration expected, not 'return'
temp.d(3): no identifier for declarator bar2
temp.d(3): semicolon expected, not 'immutable'
temp.d(3): Declaration expected, not 'return'
temp.d(4): no identifier for declarator bar3
temp.d(4): semicolon expected, not 'shared'
temp.d(4): Declaration expected, not 'return'
temp.d(7): no identifier for declarator baz1
temp.d(7): semicolon expected, not 'const'
temp.d(7): Declaration expected, not 'return'
temp.d(8): no identifier for declarator baz2
temp.d(8): semicolon expected, not 'immutable'
temp.d(8): Declaration expected, not 'return'

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