gcc/libstdc++-v3/include/bits
Jonathan Wakely ac28c9730c
libstdc++: Make CTAD ignore pair(const T1&, const T2&) constructor [PR110853]
For the pair(T1, T2) explicit deduction type to decay its arguments as
intended, we need the pair(const T1&, const T2&) constructor to not be
used for CTAD. Otherwise we try to instantiate pair<T1, T2> without
decaying, which is ill-formed for function lvalues.

Use std::type_identity_t<T1> to make the constructor unusable for an
implicit deduction guide.

libstdc++-v3/ChangeLog:

	PR libstdc++/110853
	* include/bits/stl_pair.h [C++20] (pair(const T1&, const T2&)):
	Use std::type_identity_t<T1> for first parameter.
	* testsuite/20_util/pair/cons/110853.cc: New test.

Reviewed-by: Patrick Palka <ppalka@redhat.com>
Reviewed-by: Tomasz Kamiński <tkaminsk@redhat.com>
(cherry picked from commit 0bb0d1d288)
2025-09-04 17:35:10 +01:00
..
algorithmfwd.h libstdc++: Add deprecated attribute to std::random_shuffle declarations 2023-07-28 18:30:54 +01:00
align.h Update copyright years. 2023-01-16 11:52:17 +01:00
alloc_traits.h libstdc++: Fix some -Wunused-parameter warnings 2023-11-09 08:04:31 +00:00
allocated_ptr.h Update copyright years. 2023-01-16 11:52:17 +01:00
allocator.h libstdc++: Constrain std::vector default constructor [PR113841] 2024-04-03 11:45:29 +01:00
atomic_base.h Update copyright years. 2023-01-16 11:52:17 +01:00
atomic_futex.h libstdc++: Fix std::future::wait_until for subsecond negative times [PR118093] 2025-04-16 20:13:33 +01:00
atomic_timed_wait.h Update copyright years. 2023-01-16 11:52:17 +01:00
atomic_wait.h libstdc++: Use <cstdint> instead of <stdint.h> in <bits/atomic_wait.h> 2023-12-09 20:07:21 +00:00
basic_ios.h libstdc++: Add Doxygen comment for string::resize_and_overwite 2023-02-27 13:42:21 +00:00
basic_ios.tcc Update copyright years. 2023-01-16 11:52:17 +01:00
basic_string.h libstdc++: std::string move assignment should not use POCCA trait [PR116641] 2024-10-04 10:09:14 +01:00
basic_string.tcc libstdc++: Fix std::basic_string::resize_and_overwrite 2023-11-09 08:04:31 +00:00
boost_concept_check.h Update copyright years. 2023-01-16 11:52:17 +01:00
c++0x_warning.h Update copyright years. 2023-01-16 11:52:17 +01:00
c++config libstdc++: Downgrade DEBUG to ASSERTIONS when !HOSTED 2023-04-05 18:45:14 +02:00
char_traits.h libstdc++: Fix std::char_traits<C>::move [PR113200] 2024-01-06 13:39:49 +00:00
charconv.h Update copyright years. 2023-01-16 11:52:17 +01:00
chrono.h libstdc++: Make system_clock::to_time_t always_inline [PR99832] 2025-06-11 09:19:15 +01:00
chrono_io.h libstdc++: Fix localized %c formatting for <chrono> [PR117085] 2024-10-16 20:55:24 +01:00
codecvt.h Update copyright years. 2023-01-16 11:52:17 +01:00
concept_check.h Update copyright years. 2023-01-16 11:52:17 +01:00
cow_string.h libstdc++: Add @headerfile and @since to doxygen comments [PR40380] 2023-04-28 13:31:52 +01:00
cpp_type_traits.h libstdc++: Fix @headername for bits/cpp_type_traits.h 2024-10-04 10:09:15 +01:00
deque.tcc libstdc++: Fix std::deque::emplace calling wrong _M_insert_aux [PR90389] 2025-03-31 12:05:16 +01:00
enable_special_members.h Update copyright years. 2023-01-16 11:52:17 +01:00
erase_if.h Update copyright years. 2023-01-16 11:52:17 +01:00
forward_list.h libstdc++: Add @headerfile and @since to doxygen comments [PR40380] 2023-04-28 13:31:52 +01:00
forward_list.tcc Update copyright years. 2023-01-16 11:52:17 +01:00
fs_dir.h libstdc++: Add missing parts of LWG 3480 for directory iterators [PR117560] 2024-12-07 10:08:51 +00:00
fs_fwd.h Update copyright years. 2023-01-16 11:52:17 +01:00
fs_ops.h libstdc++: Fix uses of non-reserved names in headers 2023-02-16 10:24:45 +00:00
fs_path.h libstdc++: Add @headerfile and @since to doxygen comments [PR40380] 2023-04-28 13:31:52 +01:00
fstream.tcc Update copyright years. 2023-01-16 11:52:17 +01:00
functexcept.h Update copyright years. 2023-01-16 11:52:17 +01:00
functional_hash.h Update copyright years. 2023-01-16 11:52:17 +01:00
gslice.h Update copyright years. 2023-01-16 11:52:17 +01:00
gslice_array.h libstdc++: Reduce Doxygen output for PDF 2023-04-27 11:35:02 +01:00
hashtable.h libstdc++: backport inline keyword on std::find 2025-01-10 21:39:36 +00:00
hashtable_policy.h libstdc++: Do not define _Insert_base::try_emplace before C++17 2024-12-07 10:08:51 +00:00
indirect_array.h libstdc++: Reduce Doxygen output for PDF 2023-04-27 11:35:02 +01:00
invoke.h Update copyright years. 2023-01-16 11:52:17 +01:00
ios_base.h Update copyright years. 2023-01-16 11:52:17 +01:00
istream.tcc libstdc++: Do not use facets cached in ios for ATL128 build [PR103387] 2023-03-28 23:51:47 +01:00
iterator_concepts.h libstdc++: Fix ranges::iter_move handling of rvalues [PR106612] 2025-04-16 20:13:34 +01:00
list.tcc libstdc++: Fix a -Wsign-compare warning in std::list 2024-03-12 11:53:05 +00:00
locale_classes.h Update copyright years. 2023-01-16 11:52:17 +01:00
locale_classes.tcc libstdc++: Do not assume existence of char8_t codecvt facet 2023-06-06 14:33:46 +01:00
locale_conv.h Update copyright years. 2023-01-16 11:52:17 +01:00
locale_facets.h Update copyright years. 2023-01-16 11:52:17 +01:00
locale_facets.tcc Update copyright years. 2023-01-16 11:52:17 +01:00
locale_facets_nonio.h Update copyright years. 2023-01-16 11:52:17 +01:00
locale_facets_nonio.tcc libstdc++: Fix "IEE" typo in comment in std::time_put::do_put 2025-03-31 12:05:18 +01:00
localefwd.h Update copyright years. 2023-01-16 11:52:17 +01:00
mask_array.h libstdc++: Reduce Doxygen output for PDF 2023-04-27 11:35:02 +01:00
max_size_type.h libstdc++: Fix __max_diff_type::operator>>= for negative values 2023-04-28 18:21:17 -04:00
memory_resource.h libstdc++: Undeprecate std::pmr::polymorphic_allocator::destroy (P2875R4) 2025-04-16 10:02:12 +01:00
memoryfwd.h Update copyright years. 2023-01-16 11:52:17 +01:00
mofunc_impl.h libstdc++: Fix typos in doxygen comments 2023-04-27 11:35:04 +01:00
move.h libstdc++: Simplify preprocessor/namespace nesting in <bits/move.h> 2023-04-28 13:33:20 +01:00
move_only_function.h libstdc++: Make std::move_only_function never valueless in std::variant 2022-06-27 11:08:16 +01:00
new_allocator.h libstdc++: Do not use C++11 alignof in C++98 mode [PR104395] 2025-04-16 20:13:33 +01:00
node_handle.h libstdc++: Destroy allocators in re-inserted container nodes [PR114401] 2024-04-03 11:45:29 +01:00
ostream.tcc libstdc++: Do not use facets cached in ios for ATL128 build [PR103387] 2023-03-28 23:51:47 +01:00
ostream_insert.h Update copyright years. 2023-01-16 11:52:17 +01:00
parse_numbers.h Update copyright years. 2023-01-16 11:52:17 +01:00
postypes.h Update copyright years. 2023-01-16 11:52:17 +01:00
predefined_ops.h Update copyright years. 2023-01-16 11:52:17 +01:00
ptr_traits.h libstdc++: Harmonize <version> and other headers 2023-04-05 18:45:14 +02:00
quoted_string.h libstdc++: Add @headerfile and @since to doxygen comments [PR40380] 2023-04-28 13:31:52 +01:00
random.h libstdc++: Improve doxygen docs for <random> 2023-04-28 13:33:31 +01:00
random.tcc libstdc++: Fix infinite loop in std::binomial_distribution [PR114359] 2024-05-14 10:50:49 +01:00
range_access.h Update copyright years. 2023-01-16 11:52:17 +01:00
ranges_algo.h libstdc++: fix a dangling reference crash in ranges::is_permutation [PR118160] 2025-06-06 10:14:12 +01:00
ranges_algobase.h libstdc++: Fix std::ranges::iota is not included in numeric [PR108760] 2025-04-16 20:13:35 +01:00
ranges_base.h libstdc++: Implement LWG 3664 changes to ranges::distance 2025-05-27 16:10:13 -04:00
ranges_cmp.h libstdc++: Implement range_adaptor_closure from P2387R3 [PR108827] 2023-04-18 07:24:21 -04:00
ranges_uninitialized.h libstdc++: Replace use of __mindist in ranges::uninitialized_xxx algos [PR101587] 2025-04-08 18:11:08 +01:00
ranges_util.h libstdc++: add missing include in ranges_util.h 2025-04-16 20:13:33 +01:00
refwrap.h Update copyright years. 2023-01-16 11:52:17 +01:00
regex.h libstdc++: Define std::sub_match::swap member function (LWG 3204) 2023-04-05 11:37:19 +01:00
regex.tcc libstdc++: Minor fixes to doxygen comments 2023-04-28 13:33:29 +01:00
regex_automaton.h libstdc++: Fix uses of non-reserved names in headers 2023-02-16 10:24:45 +00:00
regex_automaton.tcc libstdc++: Fix uses of non-reserved names in headers 2023-02-16 10:24:45 +00:00
regex_compiler.h Update copyright years. 2023-01-16 11:52:17 +01:00
regex_compiler.tcc Update copyright years. 2023-01-16 11:52:17 +01:00
regex_constants.h Update copyright years. 2023-01-16 11:52:17 +01:00
regex_error.h Update copyright years. 2023-01-16 11:52:17 +01:00
regex_executor.h Update copyright years. 2023-01-16 11:52:17 +01:00
regex_executor.tcc libstdc++: Fix some -Wunused-parameter warnings 2023-11-09 08:04:31 +00:00
regex_scanner.h Update copyright years. 2023-01-16 11:52:17 +01:00
regex_scanner.tcc libstdc++: Fix uses of non-reserved names in headers 2023-02-16 10:24:45 +00:00
requires_hosted.h libstdc++: Mark headers that must be hosted as such [PR103626] 2022-10-03 15:43:48 +01:00
semaphore_base.h Update copyright years. 2023-01-16 11:52:17 +01:00
shared_ptr.h Update copyright years. 2023-01-16 11:52:17 +01:00
shared_ptr_atomic.h libstdc++: Fix some -Wmismatched-tags warnings 2023-11-09 08:04:31 +00:00
shared_ptr_base.h libstdc++: fix compile error when converting std::weak_ptr<T[]> 2025-06-05 18:20:40 +01:00
slice_array.h libstdc++: Reduce Doxygen output for PDF 2023-04-27 11:35:02 +01:00
specfun.h Update copyright years. 2023-01-16 11:52:17 +01:00
sstream.tcc Update copyright years. 2023-01-16 11:52:17 +01:00
std_abs.h libstdc++: Fix std::abs(__float128) for -NaN and -0.0 [PR109758] 2023-06-01 18:11:08 +01:00
std_function.h Update copyright years. 2023-01-16 11:52:17 +01:00
std_mutex.h Update copyright years. 2023-01-16 11:52:17 +01:00
std_thread.h link pthread_join from std::thread ctor 2023-03-03 16:06:44 -03:00
stl_algo.h libstdc++: Add deprecated attribute to std::random_shuffle declarations 2023-07-28 18:30:54 +01:00
stl_algobase.h libstdc++: Fix conditions for using memcmp in std::lexicographical_compare_three_way [PR113960] 2024-03-01 10:52:12 +00:00
stl_bvector.h libstdc++: Fix std::vector<bool>::emplace to forward parameter 2024-12-07 10:08:51 +00:00
stl_construct.h libstdc++: Qualify calls to std::_Destroy and _Destroy_aux 2023-07-18 10:03:15 +01:00
stl_deque.h libstdc++: Fix std::deque::emplace calling wrong _M_insert_aux [PR90389] 2025-03-31 12:05:16 +01:00
stl_function.h Update copyright years. 2023-01-16 11:52:17 +01:00
stl_heap.h Update copyright years. 2023-01-16 11:52:17 +01:00
stl_iterator.h libstdc++: Fix constraint recursion in basic_const_iterator operator- [PR115046] 2025-05-27 16:38:49 -04:00
stl_iterator_base_funcs.h Update copyright years. 2023-01-16 11:52:17 +01:00
stl_iterator_base_types.h libstdc++: Use alias template for iterator_category [PR110970] 2023-08-11 16:36:41 +01:00
stl_list.h Update copyright years. 2023-01-16 11:52:17 +01:00
stl_map.h libstdc++: Add @headerfile and @since to doxygen comments [PR40380] 2023-04-28 13:31:52 +01:00
stl_multimap.h libstdc++: Add @headerfile and @since to doxygen comments [PR40380] 2023-04-28 13:31:52 +01:00
stl_multiset.h libstdc++: Add @headerfile and @since to doxygen comments [PR40380] 2023-04-28 13:31:52 +01:00
stl_numeric.h Update copyright years. 2023-01-16 11:52:17 +01:00
stl_pair.h libstdc++: Make CTAD ignore pair(const T1&, const T2&) constructor [PR110853] 2025-09-04 17:35:10 +01:00
stl_queue.h Update copyright years. 2023-01-16 11:52:17 +01:00
stl_raw_storage_iter.h Update copyright years. 2023-01-16 11:52:17 +01:00
stl_relops.h Update copyright years. 2023-01-16 11:52:17 +01:00
stl_set.h libstdc++: Add @headerfile and @since to doxygen comments [PR40380] 2023-04-28 13:31:52 +01:00
stl_stack.h Update copyright years. 2023-01-16 11:52:17 +01:00
stl_tempbuf.h Update copyright years. 2023-01-16 11:52:17 +01:00
stl_tree.h libstdc++: Destroy allocators in re-inserted container nodes [PR114401] 2024-04-03 11:45:29 +01:00
stl_uninitialized.h libstdc++: Fix some -Wunused-parameter warnings 2023-11-09 08:04:31 +00:00
stl_vector.h libstdc++: Use constexpr instead of _GLIBCXX20_CONSTEXPR in <vector> 2025-03-31 12:05:17 +01:00
stream_iterator.h libstdc++: Make std::istream_iterator copy ctor constexpr (LWG 3600) 2023-03-22 17:48:19 +00:00
streambuf.tcc Update copyright years. 2023-01-16 11:52:17 +01:00
streambuf_iterator.h libstdc++: Fix some -Wunused-parameter warnings 2023-11-09 08:04:31 +00:00
string_view.tcc Update copyright years. 2023-01-16 11:52:17 +01:00
stringfwd.h Update copyright years. 2023-01-16 11:52:17 +01:00
this_thread_sleep.h Update copyright years. 2023-01-16 11:52:17 +01:00
uniform_int_dist.h libstdc++: Improve doxygen docs for <random> 2023-04-28 13:33:31 +01:00
unique_lock.h Update copyright years. 2023-01-16 11:52:17 +01:00
unique_ptr.h libstdc++: Harmonize <version> and other headers 2023-04-05 18:45:14 +02:00
unordered_map.h libstdc++: Add @headerfile and @since to doxygen comments [PR40380] 2023-04-28 13:31:52 +01:00
unordered_set.h libstdc++: Add @headerfile and @since to doxygen comments [PR40380] 2023-04-28 13:31:52 +01:00
uses_allocator.h libstdc++: Fix some -Wunused-parameter warnings 2023-11-09 08:04:31 +00:00
uses_allocator_args.h libstdc++: Fix uses_allocator_construction_args for pair<T&&, U&&> [PR108952] 2023-02-28 09:49:11 +00:00
utility.h libstdc++: Add static_assert to std::integer_sequence [PR112473] 2023-12-06 09:47:27 +00:00
valarray_after.h Update copyright years. 2023-01-16 11:52:17 +01:00
valarray_array.h Update copyright years. 2023-01-16 11:52:17 +01:00
valarray_array.tcc Update copyright years. 2023-01-16 11:52:17 +01:00
valarray_before.h Update copyright years. 2023-01-16 11:52:17 +01:00
vector.tcc libstdc++: Fix -Warray-bounds warning in std::vector<bool> [PR110498] 2025-04-02 12:37:04 +01:00