Thread overview | ||||||
---|---|---|---|---|---|---|
|
June 30, 2013 [Issue 10510] New: enforce can't take an extern(C) function to call | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=10510 Summary: enforce can't take an extern(C) function to call Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nobody@puremagic.com ReportedBy: andrej.mitrovich@gmail.com --- Comment #0 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-06-30 06:52:46 PDT --- ----- import std.exception; import core.exception; import core.stdc.stdlib; void foo() { } extern(C) void cFoo() { } void main() { auto p1 = enforce(malloc(10), &foo); auto p2 = enforce(malloc(10), &cFoo); // error // example use-case // auto p = enforce(malloc(10), &onOutOfMemoryError); } ----- The constraint on enforce is: ----- if (is(Dg : void delegate()) || is(Dg : void function())) ----- I guess we need some kind of trait to fake the calling convention to be D in order to compare it against the type, such as: ----- if (is(ToExternD!Dg : void delegate()) || is(ToExternD!Dg : void function())) ----- -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 01, 2013 [Issue 10510] enforce can't take an extern(C) function to call | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=10510 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull AssignedTo|nobody@puremagic.com |andrej.mitrovich@gmail.com --- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-07-01 10:41:13 PDT --- https://github.com/D-Programming-Language/phobos/pull/1382 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 01, 2013 [Issue 10510] enforce can't take an extern(C) function to call | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=10510 --- Comment #2 from github-bugzilla@puremagic.com 2013-07-01 11:06:17 PDT --- Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/62f6459b49c5fba36eafeee7da28d440a186b915 Fix Issue 10510 - enforce should take any callable function without regard for calling conventions. https://github.com/D-Programming-Language/phobos/commit/141b234e5246f08d53484face5076f92df8833c2 Merge pull request #1382 from AndrejMitrovic/Fix10510 Issue 10510 - enforce should take any callable function -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
July 01, 2013 [Issue 10510] enforce can't take an extern(C) function to call | ||||
---|---|---|---|---|
| ||||
Posted in reply to Andrej Mitrovic | http://d.puremagic.com/issues/show_bug.cgi?id=10510 Andrej Mitrovic <andrej.mitrovich@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |FIXED -- 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