July 27, 2014 [Issue 13216] New: Failed anti-hijacking of with statement | ||||
---|---|---|---|---|
| ||||
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@puremagic.com Reporter: bearophile_hugs@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 -- |
Copyright © 1999-2021 by the D Language Foundation