Bug 24055 – is(x == __parameters) does not work on function pointer/delegate types

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
Windows
Creation time
2023-07-24T16:02:28Z
Last change time
2023-07-25T06:53:05Z
Keywords
pull
Assigned to
No Owner
Creator
Adam D. Ruppe

Comments

Comment #0 by destructionator — 2023-07-24T16:02:28Z
The bugzilla search found this old thing with a similar title but different body: https://issues.dlang.org/show_bug.cgi?id=10557 that was about default params, but this is about the thing as a whole. Notice the following: --- void function(int) fp; void delegate(int) dg; static assert(is(typeof(fp) == __parameters)); // fails, but should succeed per spec static assert(is(typeof(*fp) == __parameters)); // OK, this is how you extract in current system static assert(is(typeof(dg) == __parameters)); // fails but should succeed per spec // this is how you extract in current impl static if(is(typeof(dg) FP == delegate)) static assert(is(FP == __parameters)); // OK else static assert(0); --- (you will have to comment one or the other test to actually see the failure) The spec says: https://dlang.org/spec/expression.html#IsExpression === __parameters the parameter sequence of a function, delegate, or function pointer. This includes the parameter types, names, and default values. === The spec specifically states it should take a delegate or function pointer directly. Has failed in all dmd versions I've tried.
Comment #1 by dlang-bot — 2023-07-24T20:03:22Z
@dkorpel created dlang/dmd pull request #15453 "Fix 24055 - is(x == __parameters) does not work on function pointers" fixing this issue: - Fix 24055 - is(x == __parameters) does not work on function pointers https://github.com/dlang/dmd/pull/15453
Comment #2 by dlang-bot — 2023-07-25T06:53:05Z
dlang/dmd pull request #15453 "Fix 24055 - is(x == __parameters) does not work on function pointers" was merged into master: - 0c1e94f17883ee9c6b705dd94b674b18b77fd413 by Dennis Korpel: Fix 24055 - is(x == __parameters) does not work on function pointers https://github.com/dlang/dmd/pull/15453