Unable to test for function name
Stewart Gordon
smjg_1998 at yahoo.com
Fri Nov 30 08:52:14 PST 2007
"Janice Caron" <caron800 at googlemail.com> wrote in message
news:mailman.195.1196435027.2338.digitalmars-d at puremagic.com...
> This no longer works in D2.008.
>
> struct A
> {
> void f() {}
>
> static assert(is(f));
> }
<snip>
> Under D2.007, the static assert would pass, because f exists.
Because f exits? How did you come to that conclusion? I thought the
halting problem was unsolvable.
> In D2.008, the static assert fails. Why?
Because a bug has been fixed. To evaluate to true, IsExpression requires
that its operand is a semantically valid _type_.
> More importantly, how do I test that a function exists in D2.008?
static assert(is(typeof(f) == function));
(tested only on 1.023 and 2.007 to date)
Stewart.
--
My e-mail address is valid but not my primary mailbox. Please keep replies
on the 'group where everybody may benefit.
More information about the Digitalmars-d
mailing list