www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2091] New: D2 final cannot be applied to variable

reply d-bugmail puremagic.com writes:

           Summary: D2 final cannot be applied to variable
           Product: D
           Version: 2.013
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: gide nwawudu.com

The following code compiles on D1 but fails on D2. I think 'final:' is being
applied to the whole class.

class Bar { }

class Foo {
    this() {}
    Bar getBar() {
      return b;
    Bar b;      

void main() {

c:\> dmd test.d
test.d(11): variable c.Foo.b final cannot be applied to variable

May 10 2008
parent d-bugmail puremagic.com writes:

bugzilla digitalmars.com changed:

           What    |Removed                     |Added
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

------- Comment #1 from bugzilla digitalmars.com  2008-05-11 04:25 -------
final with a : applies until the closing } of the declaration block. That
covers the declaration of b.

The error message is correct. Not a bug.

May 11 2008