Go to file
Jonathan Wakely d96db15967 libstdc++: Deprecate non-standard std::pair constructors [PR 99957]
This deprecates the non-standard std::pair constructors that support
construction from an rvalue and a literal zero used as a null pointer
constant. We can't just add the deprecated attribute to those
constructors, because they're currently used by correct code when they
are a better match than the constructors required by the standard e.g.

  int i = 0;
  const int j = 0;
  std::pair<int, int> p(i, j); // uses pair(U1&&, const int&)

This patch adjusts the parameter types and constraints of those
constructors so that they only get used for literal zeros, and the
pair(U1&&, U2&&) constructor gets used otherwise. Once they're only used
for initializations that should be ill-formed we can add the deprecated
attribute.

The deprecated attribute is used to suggest that the user code uses
nullptr, which avoids the problem of 0 deducing as int instead of a null
pointer constant.

libstdc++-v3/ChangeLog:

	PR libstdc++/99957
	* include/bits/stl_pair.h (_PCC::_MoveCopyPair, _PCC::_CopyMovePair):
	Combine and replace with ...
	(_PCC::_DeprConsPair): New SFINAE helper function.
	(pair): Merge preprocessor blocks so that all C++03 members
	are defined together at the end.
	(pair::pair(const _T1&, _U2&&), pair::pair(_U1&&, const _T2&)):
	Replace _T1 and _T2 parameters with __null_ptr_constant and
	adjust constraints.
	* testsuite/20_util/pair/40925.cc: Use nullptr instead of 0.
	* testsuite/20_util/pair/cons/explicit_construct.cc: Likewise.
	* testsuite/20_util/pair/cons/99957.cc: New test.
2021-04-28 17:56:50 +01:00
c++tools
config
contrib Daily bump. 2021-04-28 00:16:36 +00:00
fixincludes
gcc aarch64: Fix address mode for vec_concat pattern [PR100305] 2021-04-28 17:54:52 +01:00
gnattools
gotools
include
INSTALL
intl
libada
libatomic
libbacktrace
libcc1
libcody
libcpp
libdecnumber
libffi
libgcc Daily bump. 2021-04-24 00:16:37 +00:00
libgfortran
libgo
libgomp offload-defaulted: Config option to silently ignore uninstalled offload compilers 2021-04-28 18:46:47 +02:00
libhsail-rt
libiberty Daily bump. 2021-04-22 00:16:32 +00:00
libitm
libobjc
liboffloadmic
libphobos Daily bump. 2021-04-22 00:16:32 +00:00
libquadmath
libsanitizer
libssp
libstdc++-v3 libstdc++: Deprecate non-standard std::pair constructors [PR 99957] 2021-04-28 17:56:50 +01:00
libvtv
lto-plugin Daily bump. 2021-04-22 00:16:32 +00:00
maintainer-scripts
zlib
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2021-04-24 00:16:37 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure offload-defaulted: Config option to silently ignore uninstalled offload compilers 2021-04-28 18:46:47 +02:00
configure.ac offload-defaulted: Config option to silently ignore uninstalled offload compilers 2021-04-28 18:46:47 +02:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: Add myself for write after approval 2021-04-23 09:12:43 -07:00
Makefile.def
Makefile.in
Makefile.tpl
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
symlink-tree
test-driver
ylwrap

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.