[Bug c++/123203] typo in static_assert gives confusing and verbose diagnostics
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Dec 18 14:38:45 GMT 2025
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123203
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Last reconfirmed| |2025-12-18
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
EDG is a bit better:
"sa.cc", line 2: error: expected a ","
static_assert( test() };
^
"sa.cc", line 2: error: expected a string literal
static_assert( test() };
^
"sa.cc", line 2: error: expected a ")"
static_assert( test() };
^
3 errors detected in the compilation of "sa.cc".
At least it mentions the string literal, without which the comma wouldn't help.
But all three compilers seem to want the comma, which isn't necessary since
C++17. The minimal change to fix the code is to just change } to )
More information about the Gcc-bugs
mailing list