dmd
dmd copied to clipboard
Inconsistent grammar parsing function types in parameters vs. other contexts
Vladimir Panteleev (@CyberShadow) reported this on 2021-06-20T00:09:38Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=22047
Description
extern(C) pure nothrow @safe @nogc void function() p; // OK
alias extern(C) pure nothrow @safe @nogc void function() a; // OK
alias b = extern(C) pure nothrow @safe @nogc void function() p; // OK
void fun(extern(C) pure nothrow @safe @nogc void function() p); // Error
alias b = extern(C) pure nothrow @safe @nogc void function() p; // OK
(Without the p that compiles).
alias supports StorageClass, so that works.
void fun(extern(C) pure nothrow @safe @nogc void function() p); // Error
FunctionAttributes come after the parameter list:
void fun(void function() pure nothrow @safe @nogc p); // OK
I removed extern(C), that is not in the FunctionAttribute grammar - that's #18171. I suggest we close this in favour of that one.