www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4040] New: const/immutable on the right in auto return class methods

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc


--- Comment #0 from bearophile_hugs 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: -------
Apr 01 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4040


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |samukha voliacable.com


--- Comment #1 from kennytm gmail.com 2011-05-06 02:02:17 PDT ---
*** Issue 4865 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 06 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4040


kennytm gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |k.hara.pg gmail.com


--- Comment #2 from kennytm gmail.com 2011-05-08 13:29:49 PDT ---
*** Issue 5960 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 08 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4040


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
                 CC|                            |yebblies gmail.com


--- Comment #3 from yebblies <yebblies gmail.com> 2011-06-08 22:23:59 PDT ---
https://github.com/D-Programming-Language/dmd/pull/62

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 08 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4040


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla digitalmars.com
         Resolution|                            |FIXED


--- Comment #4 from Walter Bright <bugzilla digitalmars.com> 2011-06-23
12:07:27 PDT ---
https://github.com/D-Programming-Language/dmd/commit/6a15077f8189e1ef203565edaebc766446aa105b

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 23 2011