From [5.3.3/1], I found that:
The sizeof operator shall not be applied to an expression that has function or incomplete type
Fro
From looking at CppReference.com - sizeof operator, the documentation literally states:
sizeof
cannot be used with function types, incomplete types, or bit-field glvalues.
And since void()
is a function type, then sizeof(void())
is not a legal expression.
In their usage example, we can see their error comment on this line:
std::cout << "size of function: " << sizeof(void()) << '\n'; // error