[Issue 13216] New: Failed anti-hijacking of with statement
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jul 27 07:55:49 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=13216
Issue ID: 13216
Summary: Failed anti-hijacking of with statement
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Keywords: accepts-invalid, diagnostic
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: bearophile_hugs at eml.cc
This compiles with no errors with dmd 2.066beta5. This seems a bug, a failure
of the anti-hijacking mechanism of with():
struct S { int k = 1; }
struct T { int k = 2; }
void main() {
S s;
T t;
with (t) {
assert(k == 2);
with(s) {
assert(k == 1);
}
}
}
Adapted from code by monarch_dodra:
http://forum.dlang.org/thread/txxqrxhaylixotsqimap@forum.dlang.org
--
More information about the Digitalmars-d-bugs
mailing list