https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127272
Drea Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
So the problem is the warning is emitted from the front-end and not delayed to
see if the code is never excuted. clang does not have this warning which is
why you don't see the warning even in clang.
This warning was added in response to real code acting badly (gcc itself in
this case). See PR 80560.
Anyways this exact issue was filed before as PR 84656 and closed as won't fix
as the correct fix is to use `if constexpr` or specialization for C++11.
*** This bug has been marked as a duplicate of bug 84656 ***