https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90476
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |msebor at gcc dot gnu.org Resolution|--- |WORKSFORME --- Comment #8 from Martin Sebor <msebor at gcc dot gnu.org> --- C makes it a constraint that in the #line directive: The digit sequence shall not specify zero, nor a number greater than 2147483647. Both GCC and G++ issue a pedantic warning for the directive so I think they both do the right thing and already implement the requested behavior. There could be a warning option to control this warning separately from others but that seems like a separate issue that applies to a number of other warnings as well. gcc -O2 -S -Wall -Wextra -Wpedantic -xc++ /build/tmp/a.c pr90476.c:1:7: warning: line number out of range 1 | #line 0 | ^ pr90476.c: error: ‘mytypo’ does not name a type With that I think this can be resolved.