September 26, 2004 bug in 102 with structs | ||||
---|---|---|---|---|
| ||||
module bug; import std.stdarg; struct Test { void add(...) { Test other = va_arg!(Test)(_argptr); foreach( int value; other ) { foo(); } } void foo() { printf("left is %p\n",left); bar(); } void bar() { printf("left is %p\n",left); } int opApply(int delegate(inout int val) dg){ return 0; } void* left; } int main() { Test m; m.foo(); return 0; } dmd bug.d on linux (I haven't tried Windows) and running gives left is (nil) left is 0xbfffe94c It should be (nil) both times. In other words when foo calls bar the *this pointer is probably wrong. Everything works fine if I comment out any part of the add() function or even just move add() to be defined after foo and bar - even when it never gets called. The problem wasn't in 101. This bug impacts MinTL but since moving functions around might be a work-around I'll try that. -Ben |
September 26, 2004 Re: bug in 102 with structs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle | added as odd_bug_02 to dstress Thomas |
Copyright © 1999-2021 by the D Language Foundation