[Issue 12830] New: Missed ref/out inference for delegate arguments
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat May 31 13:28:49 PDT 2014
https://issues.dlang.org/show_bug.cgi?id=12830
Issue ID: 12830
Summary: Missed ref/out inference for delegate arguments
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: bearophile_hugs at eml.cc
I am not sure, but perhaps all the following code should compile:
void main() {
void function(int x) f1;
f1 = (x) {}; // OK
void function(ref int x) f2;
f2 = (ref int x) {}; // OK
f2 = (ref x) {}; // OK
f2 = (x) {}; // Error
void function(out int x) f3;
f3 = (out int x) {}; // OK
f3 = (out x) {}; // OK
f3 = (x) {}; // Error
void delegate(int x) d1;
d1 = (x) {}; // OK
void delegate(ref int x) d2;
d2 = (ref int x) {}; // OK
d2 = (ref x) {}; // OK
d2 = (x) {}; // Error
void delegate(out int x) d3;
d3 = (out int x) {}; // OK
d3 = (out x) {}; // OK
d3 = (x) {}; // Error
}
DMD 2.066alpha gives:
test.d(7,10): Error: cannot implicitly convert expression (__lambda4) of type
void function(int x) pure nothrow @nogc @safe to void function(ref int x)
test.d(11,10): Error: cannot implicitly convert expression (__lambda7) of type
void function(int x) pure nothrow @nogc @safe to void function(out int x)
test.d(17,10): Error: cannot implicitly convert expression (__lambda11) of type
void delegate(int x) pure nothrow @nogc @safe to void delegate(ref int x)
test.d(21,10): Error: cannot implicitly convert expression (__lambda14) of type
void delegate(int x) pure nothrow @nogc @safe to void delegate(out int x)
--
More information about the Digitalmars-d-bugs
mailing list