This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/67582] typeof(*p) * fails when p is void *
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 15 Sep 2015 11:53:45 +0000
- Subject: [Bug c++/67582] typeof(*p) * fails when p is void *
- Auto-submitted: auto-generated
- References: <bug-67582-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67582
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Vegard Nossum from comment #3)
> (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.
But *p is not a valid expression, so you might as well ask for
typeof(this is nonsense and not valid C++).
You also can't ask for sizeof(*p) for a void pointer.