Having read about the most vexing parse, I experimented a bit and found this program. There are two very similar lines. One of them yields warnings in both g++7 and clang++-3.9, another does not.
int main() {
void(); // no warning
int(); // warning: statement has no effect
}
In the second line a default-constructed object of type int
is created and immediately destroyed, thus unused. But what happens in the first line? If it was parsed the same way, it should be an error because it is illegal to create an object of type void
. On the other hand, it does not look like a function declaration as well.