Opened 13 years ago

Closed 9 years ago

#613 closed Bugs (fixed)

boost/crc.hpp uses non-standard conforming syntax

Reported by: mattiasellert Owned by: Daryle Walker
Milestone: Component: crc
Version: None Severity: Problem
Keywords: Cc:


[ellert@ellert ~]$ g++ -pedantic -x c++
/usr/include/boost/crc.hpp:464: error: ISO C++ forbids
variable-size array `table_type'

[ellert@ellert ~]$ g++ --version
g++ (GCC) 3.4.4 20050721 (Red Hat 3.4.4-2)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying
conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A

The header file uses a non-constant expression as the
size in an array declaration. This is not valid c++,
and the compiler rejects it when using the -pedantic flag.

Change History (4)

comment:1 Changed 13 years ago by mattiasellert

Summary: boost/crc.hpp used non-standard conforming syntaxboost/crc.hpp uses non-standard conforming syntax

comment:2 Changed 13 years ago by mattiasellert

Logged In: YES 

The expression used as array size is declared
BOOST_STATIC_CONSTANT, so it should be permissable.

Checking various compiler versions...

gcc 3.4.4, 3.4.5 and 4.0.0 fails.
gcc 4.0.2 works.

If I change the offending line from:

typedef value_type   table_type[ byte_combos ];


typedef value_type   table_type[ 1ul << CHAR_BIT ];

it works on all these 4 versions of the compiler. Since
byte_combos is declared as

BOOST_STATIC_CONSTANT( std::size_t, byte_combos = (1ul <<

this should be the same. Looks like a compiler bug.

comment:3 Changed 11 years ago by Daryle Walker

Component: Nonecrc
Severity: Problem

comment:4 Changed 9 years ago by Steven Watanabe

Resolution: Nonefixed
Status: assignedclosed

(In [53646]) Workaround gcc problems with -pedantic. Fixes #613

Note: See TracTickets for help on using tickets.