[Issue 16226] New: -dip25 doesn't work if the return type is not explicit
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Fri Jul 1 18:13:08 PDT 2016
https://issues.dlang.org/show_bug.cgi?id=16226
Issue ID: 16226
Summary: -dip25 doesn't work if the return type is not explicit
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: issues.dlang at jmdavisProg.com
This code results in an error with -dip25:
void main() @safe
{
int i;
foo(i);
}
ref int foo(ref int bar) @safe
{
return bar;
}
but this code
void main() @safe
{
int i;
foo(i);
}
ref foo(ref int bar) @safe
{
return bar;
}
and this code
void main() @safe
{
int i;
foo(i);
}
ref auto foo(ref int bar) @safe
{
return bar;
}
do not result in an error. Note that unless the return type actually includes
int explictly rather than letting it be inferred, -dip25 is bypassed
completely. Interestingly enough, it does catch this case though and error out
correctly:
void main() @safe
{
foo();
}
ref foo() @safe
{
int bar = 42;
return bar;
}
--
More information about the Digitalmars-d-bugs
mailing list