Bug 9413 – Incorrect modification inside contracts is not detected correctly
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-01-27T23:46:00Z
Last change time
2013-04-03T01:31:55Z
Keywords
accepts-invalid, diagnostic, pull
Assigned to
nobody
Creator
k.hara.pg
Comments
Comment #0 by k.hara.pg — 2013-01-27T23:46:20Z
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.