[Issue 21554] Invalid assignment expression yields valid type in is(typeof)-expression

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 18 02:34:30 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=21554

Boris Carvajal <boris2.9 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |boris2.9 at gmail.com

--- Comment #1 from Boris Carvajal <boris2.9 at gmail.com> ---
Is not this intended? typeof doesn't evaluate the expression.
I remember seeing phobos depending on this exact behavior.

class A { int fun(); }

static assert(is(typeof(A.fun()) ==  int));

static assert(!__traits(compiles, A.fun())); // Error: need this for fun of
type int()

--


More information about the Digitalmars-d-bugs mailing list