gcc/libstdc++-v3
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
..
config aix: add FAT library support for libstdc++fs.a 2020-10-11 11:47:00 -04:00
doc libstdc++: Update C++20 status documentation 2020-10-13 17:40:43 +01:00
include libstdc++: Fix ODR violations caused by <tr1/functional> 2020-10-27 16:32:53 +00:00
libsupc++ libstdc++: Fix declarations of memalign etc. for freestanding [PR 97570] 2020-10-26 12:02:50 +00:00
po
python
scripts libstdc++: Pass CXXFLAGS to check_performance script 2020-10-09 14:01:55 +01:00
src libstdc++: Fix directory_iterator exception specification 2020-10-27 14:50:37 +00:00
testsuite libstdc++: Include <cstdint> in tests that use std::uintptr_t 2020-10-27 13:48:54 +00:00
acinclude.m4
aclocal.m4
ChangeLog Daily bump. 2020-10-27 00:16:28 +00:00
ChangeLog-1998
ChangeLog-1999
ChangeLog-2000
ChangeLog-2001
ChangeLog-2002
ChangeLog-2003
ChangeLog-2004
ChangeLog-2005
ChangeLog-2006
ChangeLog-2007
ChangeLog-2008
ChangeLog-2009
ChangeLog-2010
ChangeLog-2011
ChangeLog-2012
ChangeLog-2013
ChangeLog-2014
ChangeLog-2015
ChangeLog-2016
ChangeLog-2017
ChangeLog-2018
ChangeLog-2019
config.h.in
configure Scope libstdc++ configuration for vxworks to all versions 2020-10-22 16:40:57 +00:00
configure.ac
configure.host Scope libstdc++ configuration for vxworks to all versions 2020-10-22 16:40:57 +00:00
crossconfig.m4 Scope libstdc++ configuration for vxworks to all versions 2020-10-22 16:40:57 +00:00
fragment.am
linkage.m4
Makefile.am
Makefile.in
README

file: libstdc++-v3/README

New users may wish to point their web browsers to the file
index.html in the 'doc/html' subdirectory.  It contains brief
building instructions and notes on how to configure the library in
interesting ways.