d4fd8638be
The placeholders for std::tr1::bind are defined in an anonymous namespace, which means they have internal linkage. This will cause ODR violations when used in function templates (such as std::tr1::bind) from multiple translation units. Although probably harmless (every definition will generate identical code, even if technically ill-formed) we can avoid the ODR violations by reusing the std::placeholder objects as the std::tr1::placeholder objects. To make this work, the std::_Placeholder type needs to be defined for C++98 mode, so that <tr1/functional> can use it. The members of the std::placeholder namespace must not be defined by <functional> in C++98 mode, because "placeholders", "_1", "_2" etc. are not reserved names in C++98. Instead they can be declared in <tr1/functional>, because those names *are* reserved in that header. With the std::placeholders objects declared, a simple using-directive suffices to redeclare them in namespace std::tr1::placeholders. This means any use of the TR1 placeholders actually refers to the C++11 placeholders, which are defined with external linkage and exported from the library, so don't cause ODR violations. libstdc++-v3/ChangeLog: * include/std/functional (std::_Placeholder): Define for C++98 as well as later standards. * include/tr1/functional (std::placeholders::_1 etc): Declare for C++98. (tr1::_Placeholder): Replace with using-declaration for std::_Placeholder. (tr1::placeholders::_1 etc.): Replace with using-directive for std::placeholders. |
||
---|---|---|
.. | ||
array | ||
bessel_function.tcc | ||
beta_function.tcc | ||
ccomplex | ||
cctype | ||
cfenv | ||
cfloat | ||
cinttypes | ||
climits | ||
cmath | ||
complex | ||
complex.h | ||
cstdarg | ||
cstdbool | ||
cstdint | ||
cstdio | ||
cstdlib | ||
ctgmath | ||
ctime | ||
ctype.h | ||
cwchar | ||
cwctype | ||
ell_integral.tcc | ||
exp_integral.tcc | ||
fenv.h | ||
float.h | ||
functional | ||
functional_hash.h | ||
gamma.tcc | ||
hashtable_policy.h | ||
hashtable.h | ||
hypergeometric.tcc | ||
inttypes.h | ||
legendre_function.tcc | ||
limits.h | ||
math.h | ||
memory | ||
modified_bessel_func.tcc | ||
poly_hermite.tcc | ||
poly_laguerre.tcc | ||
random | ||
random.h | ||
random.tcc | ||
regex | ||
riemann_zeta.tcc | ||
shared_ptr.h | ||
special_function_util.h | ||
stdarg.h | ||
stdbool.h | ||
stdint.h | ||
stdio.h | ||
stdlib.h | ||
tgmath.h | ||
tuple | ||
type_traits | ||
unordered_map | ||
unordered_map.h | ||
unordered_set | ||
unordered_set.h | ||
utility | ||
wchar.h | ||
wctype.h |