Modify

Opened 8 years ago

Closed 8 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@… 8 years ago.
Suggested patch that fixes this ticket

Download all attachments as: .zip

Change History (8)

comment:1 Changed 8 years ago by Zara <zaravalle@…>

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 Changed 8 years ago by Zara <zaravalle@…>

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

Changed 8 years ago by zaravalle@…

Suggested patch that fixes this ticket

comment:3 Changed 8 years ago by zaravalle@…

  • Resolution set to fixed
  • Status changed from new to closed

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 Changed 8 years ago by anonymous

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:5 Changed 8 years ago by zaravalle@…

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

comment:6 Changed 8 years ago by danieljames

  • 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 Changed 8 years ago by zaravalle@…

  • Resolution set to fixed
  • Status changed from reopened to closed

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!

Add Comment

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain gennaro_prota.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.