[Issue 16058] `immutable delegate()` and `immutable delegate() immutable` are considered equal but treated differently
https://issues.dlang.org/show_bug.cgi?id=16058 Iain Buclaw changed: What|Removed |Added Priority|P1 |P3 --
[Issue 16058] `immutable delegate()` and `immutable delegate() immutable` are considered equal but treated differently
https://issues.dlang.org/show_bug.cgi?id=16058 timon.g...@gmx.ch changed: What|Removed |Added CC||timon.g...@gmx.ch --- Comment #4 from timon.g...@gmx.ch --- (In reply to Kenji Hara from comment #3) > From the type qualifier transitivity, immutable(int* delegate()) should be > same with immutable(int* delegate() immutable). > ... This does not follow from transitivity because the postfix `immutable` also annotates the implicit context parameter of the function pointer while the `immutable` qualifier on the delegate a priori does not. If those two types are conflated this actually leads to type system unsoundness: auto foo()pure{ int x; return ()pure{ return x++; }; } void main(){ immutable dg=foo(); // can convert to immutable as it's a strongly pure call import std.stdio; writeln(dg()," ",dg()); // 0 1, immutable context is modified } --
[Issue 16058] `immutable delegate()` and `immutable delegate() immutable` are considered equal but treated differently
https://issues.dlang.org/show_bug.cgi?id=16058 Bolpat changed: What|Removed |Added CC||qs.il.paperi...@gmail.com --
[Issue 16058] `immutable delegate()` and `immutable delegate() immutable` are considered equal but treated differently
https://issues.dlang.org/show_bug.cgi?id=16058 --- Comment #3 from Kenji Hara--- >From the type qualifier transitivity, immutable(int* delegate()) should be same with immutable(int* delegate() immutable). The root problem is in dmd implementation, TypeNext.makeXXX functions. Fixing those implementation bugs is not difficult. --
[Issue 16058] `immutable delegate()` and `immutable delegate() immutable` are considered equal but treated differently
https://issues.dlang.org/show_bug.cgi?id=16058 --- Comment #2 from ag0ae...@gmail.com --- (In reply to Eyal Lotem from comment #1) > I think it makes sense for the types not to be considered equal. > (Head-mutable ptrs to immutable data exist, so why should delegates be > inconsistent?) A head mutable delegate would be `void delegate() immutable`, no? That is considered different from the two types this is about. --
[Issue 16058] `immutable delegate()` and `immutable delegate() immutable` are considered equal but treated differently
https://issues.dlang.org/show_bug.cgi?id=16058 Sobirari Muhomorichanged: What|Removed |Added See Also||https://issues.dlang.org/sh ||ow_bug.cgi?id=1983 --
[Issue 16058] `immutable delegate()` and `immutable delegate() immutable` are considered equal but treated differently
https://issues.dlang.org/show_bug.cgi?id=16058 Eyal Lotemchanged: What|Removed |Added CC||eyal.lo...@gmail.com --- Comment #1 from Eyal Lotem --- I think it makes sense for the types not to be considered equal. (Head-mutable ptrs to immutable data exist, so why should delegates be inconsistent?) --