[Issue 10842] auto return function not executed depending on how it's called
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Aug 17 18:40:13 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10842
Andrej Mitrovic <andrej.mitrovich at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |andrej.mitrovich at gmail.com
--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2013-08-17 18:40:12 PDT ---
Reduced:
-----
auto ret1()
{
assert(0); // should throw, doesn't
return null;
}
string test1()
{
return ret1();
}
void main()
{
test1();
}
-----
If you change the return to an explicit expression, e.g. `return ""`, then the
assert is triggered.
Also perhaps noteworthy is that in older releases the reduced code used to fail
to compile, e.g. in 2.057:
Error: e2ir: cannot cast ret1() of type typeof(null) to type string
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list