Bug 22989 – Missing error wrt. assigning cast function pointer to incompatible funcptr

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2022-04-05T13:21:09Z
Last change time
2024-12-13T19:22:05Z
Keywords
accepts-invalid
Assigned to
No Owner
Creator
kinke
Moved to GitHub: dmd#20083 →

Comments

Comment #0 by kinke — 2022-04-05T13:21:09Z
With DMD v2.099.0: ``` extern(C) bool foo1(int i) { return i != 0; } extern(C) char foo2(int i) { return i != 0; } alias F1 = extern(C) bool function(int); alias F2 = extern(C) char function(int); void main() { { // normal F1 f1 = &foo1; F2 f2 = &foo2; } { // explicit cast F2 f1 = cast(F2) &foo1; F1 f2 = cast(F1) &foo2; } { // cast, but mismatch F1 f1 = cast(F2) &foo1; // bug: no error - cast seems omitted F2 f2 = cast(F1) &foo2; // ditto } } ```
Comment #1 by robert.schadek — 2024-12-13T19:22:05Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/20083 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB