Thread overview
[Issue 24325] Type inference has precedence over written type when using `static`
[Issue 24325] Type inference has precedence
Jan 08, 2024
Nick Treleaven
January 08, 2024
https://issues.dlang.org/show_bug.cgi?id=24325

Marcelo Silva Nascimento Mancini <msnmancini@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 OS|Windows                     |All
           Severity|enhancement                 |normal

--
January 08, 2024
https://issues.dlang.org/show_bug.cgi?id=24325

Marcelo Silva Nascimento Mancini <msnmancini@hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Type inference has          |Type inference has
                   |precedence                  |precedence over written
                   |                            |type when using `static`

--
January 08, 2024
https://issues.dlang.org/show_bug.cgi?id=24325

Nick Treleaven <nick@geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
                 CC|                            |nick@geany.org

--- Comment #1 from Nick Treleaven <nick@geany.org> ---
Error with v2.106 is:

Error: cannot implicitly convert expression `__lambda1` of type `typeof(null)
function() pure nothrow @nogc @safe` to `immutable(string function())`

So `CBType[]` is not ignored, but it is not used to infer the type of the template lambda.

> If `static immutable` is dropped, it compiles

Or when just `static` is dropped.

--