Bug 4040 – const/immutable on the right in auto return class methods

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-04-01T13:39:00Z
Last change time
2011-06-23T12:07:27Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
bearophile_hugs

Comments

Comment #0 by bearophile_hugs — 2010-04-01T13:39:38Z
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'
Comment #1 by kennytm — 2011-05-06T02:02:17Z
*** Issue 4865 has been marked as a duplicate of this issue. ***
Comment #2 by kennytm — 2011-05-08T13:29:49Z
*** Issue 5960 has been marked as a duplicate of this issue. ***
Comment #3 by yebblies — 2011-06-08T22:23:59Z
Comment #4 by bugzilla — 2011-06-23T12:07:27Z