]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix ambiguous std::pair constructors [PR101124]
authorJonathan Wakely <jwakely@redhat.com>
Tue, 18 Jan 2022 15:10:06 +0000 (15:10 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 18 Jan 2022 16:31:03 +0000 (16:31 +0000)
commit302343d8dd30e34516f74a61ec758d80a6c4d1db
tree651b3cfb3b599910fcee4742cdb186d1aae2cac5
parent50bc6e463b5f0696bc3cb9edd743d09b17309370
libstdc++: Fix ambiguous std::pair constructors [PR101124]

The deprecated non-standard std::pair constructors that allow
constructing std::pair<move-only-type, pointer-type> from an rvalue and
a literal zero where not sufficiently constrained. They were viable when
constructing std::pair<copyable-type, pointer-type>, and that case
should work fine using the standard constructors.

Replace the constraints on the non-standard constructors so they are
only viable in cases that should actually be ill-formed according to the
standard.

Also rename __null_ptr_constant to __zero_as_null_pointer_constant so it
matches the name of the -Wzero-as-null-pointer-constant warning. Also
make the text of the deprecated warning describe the problem in more
detail.

libstdc++-v3/ChangeLog:

PR libstdc++/101124
* include/bits/stl_pair.h (pair): Adjust constraints on
deprecated constructors accepting literal zero as null pointer
constant. Improve wording of deprecated attribute.
* testsuite/20_util/pair/cons/99957.cc: Check that deprecated
constructors do not cause ambiguities for copyable types.
libstdc++-v3/include/bits/stl_pair.h
libstdc++-v3/testsuite/20_util/pair/cons/99957.cc