public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60852] New: boost::complement of enum class does not compile
@ 2014-04-15 19:20 nevin at eviloverlord dot com
  2014-04-15 20:02 ` [Bug c++/60852] boost::has_complement " redi at gcc dot gnu.org
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: nevin at eviloverlord dot com @ 2014-04-15 19:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60852

            Bug ID: 60852
           Summary: boost::complement of enum class does not compile
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nevin at eviloverlord dot com

Created attachment 32608
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32608&action=edit
Reproducible test program

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 <boost/type_traits.hpp>
#include <iostream>

enum class E {};

int main()
{ std::cout << boost::has_complement<E>() << 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<E>::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<E,
boost::detail::has_complement_impl::dont_care, false>::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<E,
boost::detail::has_complement_impl::dont_care>::value'
/opt/local/include/boost/type_traits/detail/has_prefix_operator.hpp:202:1:  
required from 'struct boost::has_complement<E>'
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<Rhs>()),make<has_operator>())))==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<E>::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<E,
boost::detail::has_complement_impl::dont_care, false>::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<E,
boost::detail::has_complement_impl::dont_care>::value'
/opt/local/include/boost/type_traits/detail/has_prefix_operator.hpp:202:1:  
required from 'struct boost::has_complement<E>'
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<Rhs>(),returns_void_t())))));
                                                                               
                      ^
a.cpp: In function 'int main()':
a.cpp:7:41: error: cannot bind 'std::ostream {aka std::basic_ostream<char>}'
lvalue to 'std::basic_ostream<char>&&'
 { std::cout << boost::has_complement<E>() << 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<char>; _Tp = boost::has_complement<E>]'
     operator<<(basic_ostream<_CharT, _Traits>&& __os, const _Tp& __x)
     ^


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-04-17  6:19 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-15 19:20 [Bug c++/60852] New: boost::complement of enum class does not compile nevin at eviloverlord dot com
2014-04-15 20:02 ` [Bug c++/60852] boost::has_complement " redi at gcc dot gnu.org
2014-04-15 20:24 ` trippels at gcc dot gnu.org
2014-04-16  8:34 ` [Bug c++/60852] [4.8/4.9/4.10 Regression] " rguenth at gcc dot gnu.org
2014-04-16  9:31 ` redi at gcc dot gnu.org
2014-04-16  9:32 ` jakub at gcc dot gnu.org
2014-04-16  9:35 ` redi at gcc dot gnu.org
2014-04-16 10:05 ` paolo.carlini at oracle dot com
2014-04-16 12:36 ` trippels at gcc dot gnu.org
2014-04-16 13:16 ` galopin at gmail dot com
2014-04-16 14:18 ` trippels at gcc dot gnu.org
2014-04-16 21:04 ` redi at gcc dot gnu.org
2014-04-16 21:19 ` redi at gcc dot gnu.org
2014-04-17  6:19 ` trippels at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).