https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70834
--- Comment #1 from Roel Standaert <roel at abittechnical dot com> --- I guess you can't really expect the compiler to correctly infer the value of the if statement at compile time? If std::enable_if is used instead of an if statement, GCC won't generate a warning: https://godbolt.org/g/GO7Ao7 Also, if you use C++17's "if constexpr", it's fine: https://godbolt.org/g/H58gBI