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

            Bug ID: 67582
           Summary: typeof(*p) * fails when p is void *
           Product: gcc
           Version: 4.8.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vegard.nossum at gmail dot com
  Target Milestone: ---

$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4

$ cat voidptr 
void foo(void *p)
{
        typeof(*p) *x;
}

I'd expect this to work as if 'x' was declared 'void *x' (which is legal). It
works in C, but not in C++:

$ gcc -x c -c - < voidptr && echo success
success

$ gcc -x c++ -c - < voidptr
<stdin>: In function ‘int foo(void*)’:
<stdin>:3:10: error: ‘void*’ is not a pointer-to-object type
<stdin>:3:15: error: invalid type in declaration before ‘;’ token

Reply via email to