June 10, 2013 [Issue 10324] New: Wrong type for delegate.funcptr | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=10324 Summary: Wrong type for delegate.funcptr Product: D Version: unspecified Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: simen.kjaras@gmail.com --- Comment #0 from Simen Kjaeraas <simen.kjaras@gmail.com> 2013-06-10 13:30:54 PDT --- import std.stdio; auto foo() { int n = 4; return ()=>n; } void main( ) { auto dg = foo(); auto fn1 = dg.funcptr; auto fn2 = cast(int function(void*))fn1; fn2(dg.ptr); // 1 fn1(); // 2 } This program crashes with an access violation, because fn1 has the wrong type, and thus gets called with the wrong number of parameters. I'm not entirely sure what the correct type is, but I expect int function(void*), as it takes the context pointer as an additional parameter, and that is typed void*. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
August 18, 2013 [Issue 10324] Wrong type for delegate.funcptr | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen Kjaeraas | http://d.puremagic.com/issues/show_bug.cgi?id=10324 yebblies <yebblies@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |yebblies@gmail.com Resolution| |DUPLICATE --- Comment #1 from yebblies <yebblies@gmail.com> 2013-08-18 16:15:59 EST --- *** This issue has been marked as a duplicate of issue 2672 *** -- 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