https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88401
--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- That is not that easy, because what is considered invalid heavily depends on the FE (and standard version), e.g. the above is completely valid in C++20. Furthermore, warning too late in the middle-end could very well mean warning about stuff that is propagated into statements after jump threading etc. and that are dead and not something user actually wrote. As I said, if you want accurate diagnostics, use the runtime one.