[Issue 9413] New: Incorrect modification inside contracts is not detected correctly

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 27 23:46:22 PST 2013


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

           Summary: Incorrect modification inside contracts is not
                    detected correctly
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid, diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: k.hara.pg at gmail.com


--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-01-27 23:46:20 PST ---
L7 and L17 should cause errors, but doesn't.

int foo(int x)
in
{
    int a;
    int bar(int y)
    {
        x = 10; // L7
        return 2;
    }
    x = 10;     // L10 err, OK
}
out(r)
{
    int a;
    int baz(int y)
    {
        x = 10; // L17
        return 2;
    }
    x = 10;     // L20
}
body
{
    return 1;
}

output:
test.d(10): Error: variable test.foo.x cannot modify parameter 'x' in contract
test.d(10): Error: variable test.foo.x cannot modify parameter 'x' in contract
test.d(20): Error: variable test.foo.x cannot modify parameter 'x' in contract
test.d(20): Error: variable test.foo.x cannot modify parameter 'x' in contract

And, there is also duplicated error message issue.

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


More information about the Digitalmars-d-bugs mailing list