Opened 5 years ago

#13122 new Bugs

Four statics from containers_fwd.hpp should be constexpr

Reported by: robert.mcmillan@… Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: container
Version: Boost 1.63.0 Severity: Problem
Keywords: Cc:

Description

We did a study of duplicated global symbols in our modules and found four duplicated symbols coming from boost. Every compilation unit that includes this header will get four of these statics and they will be duplicated in the final executable. We had 525x4 instances of these duplicated globals in just one module.

The tool used to find this problem is described here with source code:

https://randomascii.wordpress.com/2017/01/08/add-a-const-here-delete-a-const-there

static const ordered_range_t ordered_range = ordered_range_t(); static const ordered_unique_range_t ordered_unique_range = ordered_unique_range_t(); static const default_init_t default_init = default_init_t(); static const value_init_t value_init = value_init_t();

It seems all is needed is for the BOOST_CONSTEXPR_OR_CONST to be used instead of 'const'.

Change History (0)

Note: See TracTickets for help on using tickets.