https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67582

--- Comment #3 from Vegard Nossum <vegard.nossum at gmail dot com> ---
(In reply to Jonathan Wakely from comment #1)
> You can't dereference a void*, so why do you expect to be able to get the
> type of an invalid expression?

I was under the impression that the expression was not actually evaluated, but
that only the *type* of the expression was evaluated.

For example, I would also expect this to work even though x has not been
initialised (which should otherwise be UB when dereferenced):

int *x;
typeof(*x) y;

Similarly, I would also expect the usual

#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*x))

to return 0 when passed a zero-length array. Or is that invalid too?

Reply via email to