The second static assert below fails and shouldn't since it's basically the same thing as the first one:
-------
int foo(short, double) { return 42; }
static assert(is(typeof(foo) == typeof(*(int function(short, double)).init)));
static assert(is(typeof(foo) == typeof(*(int function(A0, double)).init)), A0);
-------
Note that this works as expected:
-------
static assert(is(typeof(&foo) == int function(A0, double), A0));
-------
Comment #1 by atila.neves — 2018-09-27T13:55:02Z
Tagged as "C++" since this is preventing me from translating C++ headers.
Comment #2 by razvan.nitu1305 — 2023-04-28T11:08:19Z
I don't know if this is intentional or not, but it seems that this form of is expressions only work for the first of AST nesting.
Comment #3 by nick — 2023-10-29T11:36:32Z
I think `is` should support function types directly:
is(typeof(foo) == int(short, double))
That might be easier to pattern match for A0. AFAICT writing a function type is only allowed as the target of an alias declaration.
Comment #4 by b2.temp — 2023-10-29T15:08:45Z
> writing a function type is only allowed as the target of an alias declaration.
Yes, the reson of this restriction is that in the past the old AliasDecl syntax, i.e the one with out `=`, supported expressing a function type but not the new one.
Moving the code to parse function types everywhere should be trivial but it is true that it's not much required in usual D code.
Comment #5 by robert.schadek — 2024-12-13T19:00:41Z