www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1864] New: Variable incorrectly declared final in final class template

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1864

           Summary: Variable incorrectly declared final in final class
                    template
           Product: D
           Version: 1.027
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: samukha voliacable.com


Fails to compile with: Error: cannot modify final variable 'baz'.

----
final class Foo()
{
    void bar()
    {
        int baz;
        baz = 1;
    }
}

void main()
{
    auto foo = new Foo!();
}
----

The workaround is to define the template in full:

----
template Foo()
{
    final class Foo
    {
        void bar()
        {
            int baz;
            baz = 1;
        }                
    }
}
----


-- 
Feb 24 2008
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1864


bugzilla digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #1 from bugzilla digitalmars.com  2008-03-07 00:34 -------
Fixed dmd 1.028


-- 
Mar 06 2008