Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
July 31, 2011 [Issue 6417] New: Problem with count inside out{} of class method | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6417 Summary: Problem with count inside out{} of class method Product: D Version: D2 Platform: x86 OS/Version: Windows Status: NEW Keywords: wrong-code Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: bearophile_hugs@eml.cc --- Comment #0 from bearophile_hugs@eml.cc 2011-07-31 08:55:25 PDT --- D2 code: import core.stdc.stdio: printf; import std.algorithm: count; class Foo { void bar() out { int i = 10; count!((int k){ printf("%d\n", i); return 1; })([0]); } body {} } void main() { auto f = new Foo(); f.bar(); } It prints: 1244668 Instead of: 10 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 31, 2011 [Issue 6417] Wrong context point for delegates inside contracts of class member functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=6417 kennytm@gmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kennytm@gmail.com Platform|x86 |All Summary|Problem with count inside |Wrong context point for |out{} of class method |delegates inside contracts | |of class member functions OS/Version|Windows |All --- Comment #1 from kennytm@gmail.com 2011-07-31 15:32:23 PDT --- Reduced test case: ------------------------------- //import core.stdc.stdio; class Bug6417 { void bar() in { int i = 14; assert(i == 14); auto d = (){ assert(i == 14, "in contract failure"); // <-- fail }; //printf("%p %p\n", d.ptr, &this); d(); } out { int i = 10; assert(i == 10); (){ assert(i == 10, "out contract failure"); // <-- also fail }(); } body {} } void main() { (new Bug6417).bar(); } ------------------------------- When running, the "in contract failure" assertion will be thrown. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
May 25, 2013 [Issue 6417] Wrong context pointer for delegates inside contracts of class member functions | ||||
---|---|---|---|---|
| ||||
Posted in reply to bearophile_hugs@eml.cc | http://d.puremagic.com/issues/show_bug.cgi?id=6417 --- Comment #2 from kekeniro2@yahoo.co.jp 2013-05-24 22:35:37 PDT --- Created an attachment (id=1216) test case for foreach-opApply I'm also hit this by foreach-block using opApply-range. The test case is attached. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation