https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107065
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> --- Or as a compile-time test, not run-time: template<class, class> struct is_same { static constexpr bool value = false; }; template<class T> struct is_same<T,T> { static constexpr bool value = true; }; int main() { bool b = true; static_assert( is_same<decltype(!(!b)), bool>::value, ""); auto bb = (!(!b)); static_assert( is_same<decltype(bb), bool>::value, ""); } <source>: In function 'int main()': <source>:5:52: error: static assertion failed 5 | static_assert( is_same<decltype(!(!b)), bool>::value, ""); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~