I have a little piece of code which has a statement void();
int main()
{
void( ); // 1: parses fine in GCC 5.4.0 -Wpedantic
// void; // 2: error declaration does not declare anything
}
What is 1 void()
exactly?
- An anonymous function declaration?
- A type declaration?
- An empty expression?
What makes 1 void()
different from 2 void;
?
I have read already:
- Is sizeof(void()) a legal expression? but there void() is considered a type in sizeof
- What does the void() in decltype(void()) mean exactly? where it is considered in declspec.
- And I read Is void{} legal or not?
But I am curious if the loose statement void(); is different from one of those (and why of course)
See Question&Answers more detail:os