[Issue 11012] [TDPL] is(typeof(f) == function) fails with some functions
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Jun 22 17:11:06 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=11012
Alexander <ismailsiege at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ismailsiege at gmail.com
--- Comment #2 from Alexander <ismailsiege at gmail.com> ---
void testf(){}
void main()
{
static assert(!is(testf == function)); // OK
static assert(is(typeof(testf) == function)); // OK
static assert(is(typeof( (){} ) == delegate)); // fails
}
But "is" doesn't work with function literals themselves in the first place, it
is intended to check whether type is equivalent to function pointer or not.
Same goes for:
static if (is(typeof((int, float){}) P == function))
pragma(msg, P);
else
static assert(0); // fails
--
More information about the Digitalmars-d-bugs
mailing list