https://issues.dlang.org/show_bug.cgi?id=24265
Issue ID: 24265
Summary: ref delegate no longer implicitly converts to
unannotated type
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P3
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
This worked fine on dmd 2.098 (my mainline LTS version) but ceased working some
time between that and 2.105 (I don't feel like doing a bisect tonight):
```
void main() {
ref int alol();
typeof(&alol) dg;
int a;
dg = delegate ref() { return a; };
dg() = 5;
assert(a == 5);
}
```
me@arsd:~/test$ dmd-2098 refdg
me@arsd:~/test$ ./refdg # compiles and passes assert
me@arsd:~/test$ dmd-master refdg
refdg.d(5): Error: cannot implicitly convert expression `__dgliteral4` of type
int delegate() pure nothrow @nogc ref @safe` to `int delegate() ref`
refdg.d(5): Error: cannot implicitly convert expression `__dgliteral4` of type
int delegate() pure nothrow @nogc ref @safe` to `int delegate() ref`
Fails on the new dmd. If you write out all the attributes on the dg type:
```
void main() {
ref int alol() @safe @nogc nothrow pure;
typeof(&alol) dg;
int a;
dg = delegate ref() { return a; };
dg() = 5;
assert(a == 5);
}
```
Compiles and runs successfully on both old and new dmd.
--