Enforce allocator::value_type consistency for containers in C++2a
authorJonathan Wakely <jwakely@redhat.com>
Mon, 3 Jun 2019 13:22:59 +0000 (14:22 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Mon, 3 Jun 2019 13:22:59 +0000 (14:22 +0100)
commitebaf3659632c0d5f45ca86593562c6c8367fda67
treeb6033cee18e89d7cf52bfa6413f4d1571226478d
parentf2b00d2ba461d6dafdeccf6d93828b349b5e7f76
Enforce allocator::value_type consistency for containers in C++2a

In previous standards it is undefined for a container and its allocator
to have a different value_type. Libstdc++ has traditionally allowed it
as an extension, automatically rebinding the allocator to the
container's value_type. Since GCC 8.1 that extension has been disabled
for C++11 and later when __STRICT_ANSI__ is defined (i.e. for
-std=c++11, -std=c++14, -std=c++17 and -std=c++2a).

Since the acceptance of P1463R1 into the C++2a draft an incorrect
allocator::value_type now requires a diagnostic. This patch implements
that by enabling the static_assert for -std=gnu++2a as well.

* doc/xml/manual/status_cxx2020.xml: Document P1463R1 status.
* include/bits/forward_list.h [__cplusplus > 201703]: Enable
allocator::value_type assertion for C++2a.
* include/bits/hashtable.h: Likewise.
* include/bits/stl_deque.h: Likewise.
* include/bits/stl_list.h: Likewise.
* include/bits/stl_map.h: Likewise.
* include/bits/stl_multimap.h: Likewise.
* include/bits/stl_multiset.h: Likewise.
* include/bits/stl_set.h: Likewise.
* include/bits/stl_vector.h: Likewise.
* testsuite/23_containers/deque/48101-3_neg.cc: New test.
* testsuite/23_containers/forward_list/48101-3_neg.cc: New test.
* testsuite/23_containers/list/48101-3_neg.cc: New test.
* testsuite/23_containers/map/48101-3_neg.cc: New test.
* testsuite/23_containers/multimap/48101-3_neg.cc: New test.
* testsuite/23_containers/multiset/48101-3_neg.cc: New test.
* testsuite/23_containers/set/48101-3_neg.cc: New test.
* testsuite/23_containers/unordered_map/48101-3_neg.cc: New test.
* testsuite/23_containers/unordered_multimap/48101-3_neg.cc: New test.
* testsuite/23_containers/unordered_multiset/48101-3_neg.cc: New test.
* testsuite/23_containers/unordered_set/48101-3_neg.cc: New test.
* testsuite/23_containers/vector/48101-3_neg.cc: New test.

From-SVN: r271866
23 files changed:
libstdc++-v3/ChangeLog
libstdc++-v3/doc/xml/manual/status_cxx2020.xml
libstdc++-v3/include/bits/forward_list.h
libstdc++-v3/include/bits/hashtable.h
libstdc++-v3/include/bits/stl_deque.h
libstdc++-v3/include/bits/stl_list.h
libstdc++-v3/include/bits/stl_map.h
libstdc++-v3/include/bits/stl_multimap.h
libstdc++-v3/include/bits/stl_multiset.h
libstdc++-v3/include/bits/stl_set.h
libstdc++-v3/include/bits/stl_vector.h
libstdc++-v3/testsuite/23_containers/deque/48101-3_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/forward_list/48101-3_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/list/48101-3_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/map/48101-3_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/multimap/48101-3_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/multiset/48101-3_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/set/48101-3_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_map/48101-3_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_multimap/48101-3_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_multiset/48101-3_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/unordered_set/48101-3_neg.cc [new file with mode: 0644]
libstdc++-v3/testsuite/23_containers/vector/48101-3_neg.cc [new file with mode: 0644]