d96db15967
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. |
||
---|---|---|
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
intl | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgo | ||
libgomp | ||
libhsail-rt | ||
libiberty | ||
libitm | ||
libobjc | ||
liboffloadmic | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
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 | ||
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.