Opened 15 years ago

Closed 15 years ago

#1095 closed Bugs (fixed)

GCC warnings with -Wsign-promo

Reported by: Joaquín M López Muñoz Owned by: Daniel James
Milestone: Boost 1.35.0 Component: hash
Version: Boost 1.34.0 Severity: Cosmetic
Keywords: Cc:

Description

The mere inclusion of <boost/functional/hash.hpp> produces warnings in GCC for Boost 1.34 when -Wsign-promo is set:

In file included from /.../boost/functional/hash.hpp:10,

from ...

/.../boost/functional/hash/hash.hpp: In member function

`size_t boost::hash<bool>::operator()(bool) const':

/.../boost/functional/hash/hash.hpp:353: warning: passing

bool' chooses int' over `long unsigned int'

[...]

In Boost 1.33.1, the warnings only appear when hash<bool>, hash<ungisned char>, hash<wchar_t> or hash<short unsigned int> are instantiated --the difference between that 1.33.1 and 1.34 is that the latter automatically instantiates a number of specialization for integral types, among them the offending ones.

Although the warnings seem unharmful, it'd be great if they can be silenced by providing overloads of hash_value for all C++ integral types, so that no integral promotions occur.

Change History (2)

comment:1 by Daniel James, 15 years ago

Milestone: To Be DeterminedBoost 1.35.0
Status: newassigned

comment:2 by Daniel James, 15 years ago

Resolution: fixed
Status: assignedclosed

Fixed in [38881].

Note: See TracTickets for help on using tickets.