[Issue 24055] New: is(x == __parameters) does not work on function pointer/delegate types
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Jul 24 16:02:28 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24055
Issue ID: 24055
Summary: is(x == __parameters) does not work on function
pointer/delegate types
Product: D
Version: D2
Hardware: All
OS: Windows
Status: NEW
Severity: normal
Priority: P3
Component: dmd
Assignee: nobody at puremagic.com
Reporter: destructionator at gmail.com
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.
--
More information about the Digitalmars-d-bugs
mailing list