https://issues.dlang.org/show_bug.cgi?id=17992
RazvanN changed:
What|Removed |Added
CC||razvan.nitu1...@gmail.com
--- Comment #1 from RazvanN ---
Reduced test case:
class V
{}
auto foo(int a)
{
if (a == 1)
return null;
pragma(msg, typeof(return));
return new V();
}
void main()
{}
prints: typeof(null)
I'm not sure if this bug is valid. When semantic analysis is performed at the
point where typeof is evaluated the inference of the return type of foo (in
both examples) has only seen return statements of null. This makes inference
deduce that the type of foo is typeof(null) and this is true for that
particular point.
Changing this would require moving the typeof logic from semantic1 to semantic2
or semantic3 so that when typeof is encountered, the whole foo function has
been typechecked.
--