www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2483] New: DMD allows assignment to a scope variable

http://d.puremagic.com/issues/show_bug.cgi?id=2483

           Summary: DMD allows assignment to a scope variable
           Product: D
           Version: 1.037
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: snake.scaly gmail.com


The specs at http://www.digitalmars.com/d/1.0/attribute.html#scope say:
"Assignment to a scope, other than initialization, is not
allowed."  Nevertheless, the following code compiles:

void main()
{
  scope Object foo;
  foo = new Object;
}

Tested this in DMD 1.037, DMD 2.021, 2.019 and 1.033.


-- 
Dec 01 2008