gcc/libstdc++-v3/include
Jonathan Wakely d4fd8638be libstdc++: Fix ODR violations caused by <tr1/functional>
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.
2020-10-27 16:32:53 +00:00
..
backward libstdc++: Add deprecated attributes to old iostream members 2020-08-19 12:13:23 +01:00
bits libstdc++: Fix -Wsign-compare warnings in headers 2020-10-27 16:32:53 +00:00
c Update copyright years. 2020-01-01 12:51:42 +01:00
c_compatibility Update copyright years. 2020-01-01 12:51:42 +01:00
c_global libstdc++: Add parentheses around assignments used as truth values 2020-09-10 17:09:16 +01:00
c_std Update copyright years. 2020-01-01 12:51:42 +01:00
debug libstdc++: Replace use of reserved name that clashes [PR 97362] 2020-10-10 21:22:12 +01:00
decimal Update copyright years. 2020-01-01 12:51:42 +01:00
experimental libstdc++: Fix error in experimental::strand 2020-10-26 21:00:06 +00:00
ext libstdc++: Make allocators throw bad_array_new_length on overflow [LWG 3190] 2020-10-05 15:18:56 +01:00
parallel libstdc++: Add compile-time checks to__glibcxx_assert [PR 71960] 2020-09-01 20:52:26 +01:00
precompiled libstdc++: Remove unused header 2020-10-19 11:19:28 +01:00
pstl libstdc++: Rebase include/pstl to current upstream 2020-10-21 06:11:28 -07:00
std libstdc++: Fix ODR violations caused by <tr1/functional> 2020-10-27 16:32:53 +00:00
tr1 libstdc++: Fix ODR violations caused by <tr1/functional> 2020-10-27 16:32:53 +00:00
tr2 Update copyright years. 2020-01-01 12:51:42 +01:00
Makefile.am libstdc++: Reduce header dependencies in and on <memory> 2020-10-22 18:42:03 +01:00
Makefile.in libstdc++: Reduce header dependencies in and on <memory> 2020-10-22 18:42:03 +01:00