[Bug c++/87389] if constexpr not working properly with static_assert

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Sep 21 23:57:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87389

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Specifically, the not-taken branch of an if constexpr is only discarded when
inside a template. In a non-template both branches are compiled as normal, and
so both static assertions get compiled. Since both cannot possibly be true at
once, the program can never compile.


More information about the Gcc-bugs mailing list