during testing 4.4 snapshot i get an compilation error on boost-1.38.0
codebase.

% x86_64-gnu-linux-g++ t.ii -std=gnu++0x -c
t.ii: In member function 'size_t boost::dynamic_bitset<Block,
Allocator>::count() const':
t.ii:30558: error: 'mode' cannot appear in a constant-expression
t.ii:30558: error: template argument 1 is invalid
t.ii:30558: error: expected '>' before '*' token
t.ii:30558: error: expected '(' before '*' token
t.ii:30558: error: expected primary-expression before '>' token

(...)
template <bool value>
struct value_to_type
{
    value_to_type() {}
};
(...)
template <typename Block, typename Allocator>
typename dynamic_bitset<Block, Allocator>::size_type
dynamic_bitset<Block, Allocator>::count() const
{
    using detail::dynamic_bitset_impl::table_width;
    using detail::dynamic_bitset_impl::access_by_bytes;
    using detail::dynamic_bitset_impl::access_by_blocks;
    using detail::dynamic_bitset_impl::value_to_type;

    const bool no_padding =
        dynamic_bitset<Block, Allocator>::bits_per_block
        == 8 * sizeof(Block);

    const bool enough_table_width = table_width >= 8;

    const bool mode = (no_padding && enough_table_width)
                          ? access_by_bytes
                          : access_by_blocks;

    return do_count(m_bits.begin(), num_blocks(), Block(0),
                                       static_cast<value_to_type<mode> *>(0));
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}

4.3.3 accepts this code. is it a boost bug or 4.4 regression?


-- 
           Summary: 'expr' cannot appear in a constant-expression.
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net


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

Reply via email to