https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77462
--- Comment #2 from Daniel Frey <d.frey at gmx dot de> --- (In reply to Manuel López-Ibáñez from comment #1) Indeed, this is even worse than I thought. FWIW, here's a reduced example for my code: static_assert( 2 + 2 == 4, "oops" ); #line 1 static_assert( 2 + 2 == 5, "oops" ); Leading to the same wrong error message, no explicit setting of the file is necessary to confuse the compiler.