10

I read this question that explains how anonymous variables are invalid in C++.

But the following program compiles without any warning or errors on GCC 7.2 (even with -Wall) - demo:

int main() {
    int (*); // anonymous variable?
}

Here, this is apparently also an integer type anonymous variable. So, why GCC does not show any errors or warnings? Is this a GCC bug?

Jayesh
  • 4,755
  • 9
  • 32
  • 62

1 Answers1

5

There have been bugs recorded with gcc and how it detects variables for example I was using it to compile a simple program and it gave an error saying variable may be uninitialized when it have been. It is just a bug in the compiler. For example see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55985

Oliver Strong
  • 415
  • 1
  • 7
  • 15
  • The response was the issue has been fixed since at least gcc 5.3. OP's problem persists even for gcc 7.2 – Passer By Oct 31 '17 at 07:44
  • The problem does still persist as I have encountered this error in 7.2 the bug may have just been fixed in this individual case or something broke in a later update. – Oliver Strong Oct 31 '17 at 07:46