id,summary,reporter,owner,description,type,status,milestone,component,version,severity,resolution,keywords,cc 9913,boost::has_complement of enum class does not compile,Nevin Liber ,bronf,"(Also filed this as a gcc bug at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60852) This works under gcc 4.7.2 and clang 3.4, but fails to compile under gcc 4.9 RC1. enum class seems to be the only issue; plain enums work fine. #include #include enum class E {}; int main() { std::cout << boost::has_complement() << std::endl; } Using Boost 1.55 and g++ -std=c++11, we get: In file included from /opt/local/include/boost/config.hpp:57:0, from /opt/local/include/boost/type_traits/add_const.hpp:13, from /opt/local/include/boost/type_traits.hpp:13, from a.cpp:1: /opt/local/include/boost/type_traits/detail/has_prefix_operator.hpp: In instantiation of 'const bool boost::detail::has_complement_impl::operator_exists::value': /opt/local/include/boost/type_traits/detail/has_prefix_operator.hpp:173:4: required from 'const bool boost::detail::has_complement_impl::trait_impl1::value' /opt/local/include/boost/type_traits/detail/has_prefix_operator.hpp:195:4: required from 'const bool boost::detail::has_complement_impl::trait_impl::value' /opt/local/include/boost/type_traits/detail/has_prefix_operator.hpp:202:1: required from 'struct boost::has_complement' a.cpp:7:41: required from here /opt/local/include/boost/type_traits/detail/has_prefix_operator.hpp:152:56: error: no match for 'operator~' (operand type is 'E') BOOST_STATIC_CONSTANT(bool, value = (sizeof(check(((BOOST_TT_TRAIT_OP make()),make())))==sizeof(::boost::type_traits::yes_type))); ^ /opt/local/include/boost/type_traits/detail/has_prefix_operator.hpp: In instantiation of 'const bool boost::detail::has_complement_impl::operator_returns_void::value': /opt/local/include/boost/type_traits/detail/has_prefix_operator.hpp:173:4: required from 'const bool boost::detail::has_complement_impl::trait_impl1::value' /opt/local/include/boost/type_traits/detail/has_prefix_operator.hpp:195:4: required from 'const bool boost::detail::has_complement_impl::trait_impl::value' /opt/local/include/boost/type_traits/detail/has_prefix_operator.hpp:202:1: required from 'struct boost::has_complement' a.cpp:7:41: required from here /opt/local/include/boost/type_traits/detail/has_prefix_operator.hpp:89:102: error: no match for 'operator~' (operand type is 'E') BOOST_STATIC_CONSTANT(bool, value = (sizeof(::boost::type_traits::yes_type)==sizeof(returns_void((BOOST_TT_TRAIT_OP make(),returns_void_t()))))); ^ a.cpp: In function 'int main()': a.cpp:7:41: error: cannot bind 'std::ostream {aka std::basic_ostream}' lvalue to 'std::basic_ostream&&' { std::cout << boost::has_complement() << std::endl; } ^ In file included from /opt/local/include/gcc49/c++/istream:39:0, from /opt/local/include/gcc49/c++/sstream:38, from /opt/local/include/gcc49/c++/complex:45, from /opt/local/include/boost/type_traits/is_complex.hpp:12, from /opt/local/include/boost/type_traits.hpp:49, from a.cpp:1: /opt/local/include/gcc49/c++/ostream:602:5: note: initializing argument 1 of 'std::basic_ostream<_CharT, _Traits>& std::operator<<(std::basic_ostream<_CharT, _Traits>&&, const _Tp&) [with _CharT = char; _Traits = std::char_traits; _Tp = boost::has_complement]' operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x) ^ ",Bugs,closed,To Be Determined,type_traits,Boost 1.55.0,Problem,obsolete,,nevin@…