[Issue 23952] New: Cannot declare pointer to function with linkage
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jun 1 14:27:26 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23952
Issue ID: 23952
Summary: Cannot declare pointer to function with linkage
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: qs.il.paperinik at gmail.com
Similar to issue 2753 (Cannot declare pointer to function returning ref), the
type syntax cannot express explicit linkage of a function pointer:
```d
alias CFunc = extern(C) int function(int);
void f(CFunc fp) { } // okay
pragma(msg, CFunc);
void g(extern(C) int function(int) fp) { } // does not parse
```
The same is true for delegates:
```d
struct S
{
int x;
extern(C) int f() => x;
}
pragma(msg, typeof(&S().f)); // extern (C) int delegate()
//void h(extern (C) int delegate() dg) { } // does not parse
```
--
More information about the Digitalmars-d-bugs
mailing list