Thread overview
[Issue 17992] auto return type and null for classes
Jun 14, 2018
RazvanN
Dec 12, 2019
Basile-z
Mar 21, 2020
Basile-z
June 14, 2018
https://issues.dlang.org/show_bug.cgi?id=17992

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> ---
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.

--
December 12, 2019
https://issues.dlang.org/show_bug.cgi?id=17992

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |b2.temp@gmx.com
         Resolution|---                         |INVALID

--
March 21, 2020
https://issues.dlang.org/show_bug.cgi?id=17992

Basile-z <b2.temp@gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|b2.temp@gmx.com             |

--