https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111269
Bug ID: 111269 Summary: Confusing location of error in source code Product: gcc Version: 13.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: alx at kernel dot org Target Milestone: --- I've been confused for some time with a compilation error that pointed to a slightly-off location. I wasn't seeing that I used a temporary variable in a constant expression. The code could be reduced to: $ cat const.c int main(void) { int x = 42; _Static_assert(0 || 7 > x, ""); } $ gcc-13 -Wall -Wextra const.c const.c: In function ‘main’: const.c:6:26: error: expression in static assertion is not constant 6 | _Static_assert(0 || 7 > x, ""); | ~~^~~~~~~~ $ clang-16 -Weverything const.c const.c:6:26: error: static assertion expression is not an integral constant expression _Static_assert(0 || 7 > x, ""); ~~~~~~~~~^ 1 error generated. Clang points to the precise location of the problem, while GCC is too fuzzy. I suspect this is a duplicate of other bugs, but I'm not sure, so I'll let you decide that.