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:
http://d.puremagic.com/issues/show_bug.cgi?id=2091

           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.

test.d
------
class Bar { }

class Foo {
  final:
    this() {}
    Bar getBar() {
      return b;
    }
  private:
    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:
http://d.puremagic.com/issues/show_bug.cgi?id=2091


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