typeof function literals which define the types of its parameters but do not give their parameters names
Johannes Loher
johannes.loher at fg4f.de
Thu Dec 27 03:52:52 UTC 2018
Hey all,
I am a bit confused about the inferred types of function literals
which do not name their parameters (something like `(int) {}`).
The confusion arises from the fact that the inferred type
sometimes is `void` (might be the case, because the function
literal is inferred to be a template) and sometimes it is
something like `void function(bool _param_0) pure nothrow @nogc
@safe`. What is really weir is that seems to depend on the type
of the parameter. Here is small example showing what happens for
different parameter types: https://run.dlang.io/is/xSMZZu
Also note that this only happens for function literals. For
regular functions and member functions, `void` is never inferred,
but only types like `pure nothrow @nogc @safe void(MyClass
_param_0)`.
Has anybody any idea what is going on here? Is this a bug?
More information about the Digitalmars-d-learn
mailing list