]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Fix CTAD for debug sequence containers
authorJonathan Wakely <jwakely@redhat.com>
Tue, 17 Aug 2021 17:19:27 +0000 (18:19 +0100)
committerJonathan Wakely <jwakely@redhat.com>
Wed, 18 Aug 2021 13:26:38 +0000 (14:26 +0100)
commit085c2f8f0e13d7c1515ce86755a52a31faf0cf47
treeed866e000644f96813f3a7c485d432fb8a7af823
parentc883d1dcdea8820015ee7ffdc68c03cf3b8180bf
libstdc++: Fix CTAD for debug sequence containers

This fixes some 23_containers/*/cons/deduction.cc failures seen with
-std=c++17/-D_GLIBCXX_DEBUG, caused by non-immediate errors when
substituting template arguments into an incorrect specialization of the
std::__cxx1998 base class. This happens because the size_type member of
the debug container is _Base_type::size_type, so is non-deducible, and
the deduced types get substituted into _Base_type, triggering the
static_assert that checks the allocator's value_type matches the
container's.

The solution is to make the C(size_type, const T&, const Alloc&)
constructors of the debug sequence containers non-deducible. In order to
make CTAD work again deduction guides that use std::size_t for the first
argument are added.

Signed-off-by: Jonathan Wakely <jwakely@redhat.com>
libstdc++-v3/ChangeLog:

* include/debug/deque (deque(size_type, const T&, const A&)):
Prevent class template argument deduction and replace with a
deduction guide.
* include/debug/forward_list (forward_list(size_type, const T&, const A&)):
Likewise.
* include/debug/list (list(size_type, const T&, const A&)):
Likewise.
* include/debug/vector (vector(size_type, const T&, const A&)):
Likewise.
libstdc++-v3/include/debug/deque
libstdc++-v3/include/debug/forward_list
libstdc++-v3/include/debug/list
libstdc++-v3/include/debug/vector