https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120239

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
We could probably still do better.

Clang says:

foo.cc:3:6: error: expected ';' after expression
    3 |   { 0 };
      |      ^
      |      ;
foo.cc:3:5: warning: expression result unused [-Wunused-value]
    3 |   { 0 };
      |     ^
1 warning and 1 error generated.


This makes it a little more clear that the problem is that 0 is an expression,
not a statement, and then it also points out that the unused expression is
useless on its own.


EDG similarly points out a useless unused expression.

"foo.cc", line 3: warning: expression has no effect
    { 0 };
      ^

"foo.cc", line 3: error: expected a ";"
    { 0 };
        ^

1 error detected in the compilation of "foo.cc".

Reply via email to