Bug 21540 – Cannot pass associative array of function pointers to const AA parameter with lower attributes

Status
NEW
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2021-01-11T01:18:39Z
Last change time
2024-12-13T19:13:59Z
Keywords
rejects-valid, safe
Assigned to
No Owner
Creator
Bolpat
Moved to GitHub: dmd#19852 →

Comments

Comment #0 by qs.il.paperinik — 2021-01-11T01:18:39Z
As an example, an associative array of @safe function pointers cannot be passed to a function taking an associative array that has its value type the const version of the corresponding @system function pointers. void f(const(void function())[string] aa) { } void main() { void function() @safe fp = { }; void function() @safe[string] aa = [ "a": fp ]; f(aa); // error } For delegates instead of function pointers, the call to f compiles as it should.
Comment #1 by robert.schadek — 2024-12-13T19:13:59Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19852 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB