Opened 14 years ago

Closed 13 years ago

#2842 closed Bugs (fixed)

dynamic_bitset.hpp fails to compile with g++ (Ubuntu 4.3.3-5ubuntu2) 4.3.3

Reported by: solusstutlus@… Owned by: Gennaro Prota
Milestone: Boost 1.39.0 Component: dynamic_bitset
Version: Boost 1.38.0 Severity: Regression
Keywords: dynamic_bitset Cc: daniel_james@…

Description

source/boost/dynamic_bitset/dynamic_bitset.hpp: In member function ‘size_t boost::dynamic_bitset<Block, Allocator>::count() const’: source/boost/dynamic_bitset/dynamic_bitset.hpp:1021: error: ‘mode’ cannot appear in a constant-expression source/boost/dynamic_bitset/dynamic_bitset.hpp:1021: error: template argument 1 is invalid source/boost/dynamic_bitset/dynamic_bitset.hpp:1021: error: expected `>' before ‘*’ token source/boost/dynamic_bitset/dynamic_bitset.hpp:1021: error: expected `(' before ‘*’ token source/boost/dynamic_bitset/dynamic_bitset.hpp:1021: error: expected primary-expression before ‘>’ token

Seems like this update to gcc does not like const values passed as parameters to templates...

Attachments (1)

dynamic_bitset.patch (926 bytes ) - added by zaravalle@… 13 years ago.
Suggested patch that fixes this ticket

Download all attachments as: .zip

Change History (8)

comment:1 by Zara <zaravalle@…>, 13 years ago

The part that is not identified as constant is 'no_padding', participant in 'mode'. The other part, 'enough_table_width' is correctly identified as const.

comment:2 by Zara <zaravalle@…>, 13 years ago

Solution (apparently) found: The current file documents something introduced for GCC 3.4:

NOTE: Explicitly qualifying "bits_per_block" to workaround regressions of gcc 3.4.x const bool no_padding =

dynamic_bitset<Block, Allocator>::bits_per_block

CHAR_BIT * sizeof(Block);

Removing the explicit qualification compiles with GCC 4.3. To be tested: does the compiled object work OK?

const bool no_padding = bits_per_block == CHAR_BIT * sizeof(Block);

HTH

by zaravalle@…, 13 years ago

Attachment: dynamic_bitset.patch added

Suggested patch that fixes this ticket

comment:3 by zaravalle@…, 13 years ago

Resolution: fixed
Status: newclosed

Attached file seems to correct this problem. Explicit qualification of bits_per_block breaks compilation undef gccx 4.3, so the patch just detects this specific compiler and version (and later versions, also), and does not make the explicit qualification in such case.

Works OK with gcc 4.1 (Centos 5.x) and gcc 4.3 (ubuntu 9.04)

comment:4 by anonymous, 13 years ago

Resolution: fixed
Status: closedreopened

comment:5 by zaravalle@…, 13 years ago

I have reopened it as I accidentally closed it, but the proposed fix is still valid, from my point of view.

comment:6 by Daniel James, 13 years ago

Cc: daniel_james@… added

Hi, I was just looking at this, as I promised I would. But it seems that someone beat me to it and didn't say anything. Changes in trunk: [52879], [52880], [52881].

comment:7 by zaravalle@…, 13 years ago

Resolution: fixed
Status: reopenedclosed

Thanks to all. I have now learned something else about versions and patch levels, by loking at the definitive solution. I suppose now is the right time to close the ticket!

Note: See TracTickets for help on using tickets.