Although some compilers will allow it, the use of sizeof
and alignof
with arguments that have a void
type is
forbidden by both the C and C++ standards.
Noncompliant code example
void fun() {
void* p;
sizeof(*p); // Noncompliant
sizeof(void); // Noncompliant
alignof(*p); // Noncompliant
alignof(void); // Noncompliant
}