diff options
23 files changed, 402 insertions, 9 deletions
diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index ed1d676ab54..2fca1a36abf 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,29 @@ +2019-06-03 Jonathan Wakely <jwakely@redhat.com> + + * 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. + 2019-05-31 Gerald Pfeifer <gerald@pfeifer.com> * doc/xml/manual/allocator.xml: Move hoard.org back to http. diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2020.xml b/libstdc++-v3/doc/xml/manual/status_cxx2020.xml index 8a17747e3bd..4b0336931f4 100644 --- a/libstdc++-v3/doc/xml/manual/status_cxx2020.xml +++ b/libstdc++-v3/doc/xml/manual/status_cxx2020.xml @@ -951,6 +951,21 @@ Feature-testing recommendations for C++</link>. <entry align="center"> 9.1 </entry> <entry /> </row> + + <row> + <entry> + Mandating the Standard Library: + Clause 21 - Containers library + </entry> + <entry> + <link xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1463r1.pdf"> + P1463R1 + </link> + </entry> + <entry align="center"> 10 </entry> + <entry/> + </row> + </tbody> </tgroup> </table> diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h index 4c277845a51..e686283a432 100644 --- a/libstdc++-v3/include/bits/forward_list.h +++ b/libstdc++-v3/include/bits/forward_list.h @@ -421,7 +421,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value, "std::forward_list must have a non-const, non-volatile value_type"); -#ifdef __STRICT_ANSI__ +#if __cplusplus > 201703L || defined __STRICT_ANSI__ static_assert(is_same<typename _Alloc::value_type, _Tp>::value, "std::forward_list must have the same value_type as its allocator"); #endif diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index ab24b5bb537..384e39877f2 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -188,7 +188,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { static_assert(is_same<typename remove_cv<_Value>::type, _Value>::value, "unordered container must have a non-const, non-volatile value_type"); -#ifdef __STRICT_ANSI__ +#if __cplusplus > 201703L || defined __STRICT_ANSI__ static_assert(is_same<typename _Alloc::value_type, _Value>{}, "unordered container must have the same value_type as its allocator"); #endif diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h index 7dcb53823c4..ac76d681ff0 100644 --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -824,7 +824,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER #if __cplusplus >= 201103L static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value, "std::deque must have a non-const, non-volatile value_type"); -# ifdef __STRICT_ANSI__ +# if __cplusplus > 201703L || defined __STRICT_ANSI__ static_assert(is_same<typename _Alloc::value_type, _Tp>::value, "std::deque must have the same value_type as its allocator"); # endif diff --git a/libstdc++-v3/include/bits/stl_list.h b/libstdc++-v3/include/bits/stl_list.h index 68bab94af1e..701982538df 100644 --- a/libstdc++-v3/include/bits/stl_list.h +++ b/libstdc++-v3/include/bits/stl_list.h @@ -563,7 +563,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 #if __cplusplus >= 201103L static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value, "std::list must have a non-const, non-volatile value_type"); -# ifdef __STRICT_ANSI__ +# if __cplusplus > 201703L || defined __STRICT_ANSI__ static_assert(is_same<typename _Alloc::value_type, _Tp>::value, "std::list must have the same value_type as its allocator"); # endif diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index 322d0a8290a..b1083d572d6 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -118,7 +118,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept) #endif -#if __cplusplus >= 201103L && defined(__STRICT_ANSI__) +#if __cplusplus > 201703L || defined __STRICT_ANSI__ static_assert(is_same<typename _Alloc::value_type, value_type>::value, "std::map must have the same value_type as its allocator"); #endif diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index 4c4ccad3ac0..bb4aece96bf 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -117,7 +117,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER __glibcxx_class_requires2(value_type, _Alloc_value_type, _SameTypeConcept) #endif -#if __cplusplus >= 201103L && defined(__STRICT_ANSI__) +#if __cplusplus > 201703L || defined __STRICT_ANSI__ static_assert(is_same<typename _Alloc::value_type, value_type>::value, "std::multimap must have the same value_type as its allocator"); #endif diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index af733ea34dc..96fa14e2afa 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -109,7 +109,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER #if __cplusplus >= 201103L static_assert(is_same<typename remove_cv<_Key>::type, _Key>::value, "std::multiset must have a non-const, non-volatile value_type"); -# ifdef __STRICT_ANSI__ +# if __cplusplus > 201703L || defined __STRICT_ANSI__ static_assert(is_same<typename _Alloc::value_type, _Key>::value, "std::multiset must have the same value_type as its allocator"); # endif diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index 3131a7974b0..279b9705d78 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -107,7 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER #if __cplusplus >= 201103L static_assert(is_same<typename remove_cv<_Key>::type, _Key>::value, "std::set must have a non-const, non-volatile value_type"); -# ifdef __STRICT_ANSI__ +# if __cplusplus > 201703L || defined __STRICT_ANSI__ static_assert(is_same<typename _Alloc::value_type, _Key>::value, "std::set must have the same value_type as its allocator"); # endif diff --git a/libstdc++-v3/include/bits/stl_vector.h b/libstdc++-v3/include/bits/stl_vector.h index dd9382d254d..d33e589498a 100644 --- a/libstdc++-v3/include/bits/stl_vector.h +++ b/libstdc++-v3/include/bits/stl_vector.h @@ -397,7 +397,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER #if __cplusplus >= 201103L static_assert(is_same<typename remove_cv<_Tp>::type, _Tp>::value, "std::vector must have a non-const, non-volatile value_type"); -# ifdef __STRICT_ANSI__ +# if __cplusplus > 201703L || defined __STRICT_ANSI__ static_assert(is_same<typename _Alloc::value_type, _Tp>::value, "std::vector must have the same value_type as its allocator"); # endif diff --git a/libstdc++-v3/testsuite/23_containers/deque/48101-3_neg.cc b/libstdc++-v3/testsuite/23_containers/deque/48101-3_neg.cc new file mode 100644 index 00000000000..724b3de6a03 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/deque/48101-3_neg.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2017-2019 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include <deque> + +void +test01() +{ + std::deque<int, std::allocator<long>> c; +} + +// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/forward_list/48101-3_neg.cc b/libstdc++-v3/testsuite/23_containers/forward_list/48101-3_neg.cc new file mode 100644 index 00000000000..d0e56f59494 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/forward_list/48101-3_neg.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2017-2019 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include <forward_list> + +void +test01() +{ + std::forward_list<int, std::allocator<long>> c; +} + +// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/list/48101-3_neg.cc b/libstdc++-v3/testsuite/23_containers/list/48101-3_neg.cc new file mode 100644 index 00000000000..ce32e9ced82 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/list/48101-3_neg.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2017-2019 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include <list> + +void +test01() +{ + std::list<int, std::allocator<long>> c; +} + +// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/map/48101-3_neg.cc b/libstdc++-v3/testsuite/23_containers/map/48101-3_neg.cc new file mode 100644 index 00000000000..dfce9c2179c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/map/48101-3_neg.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2017-2019 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include <map> + +void +test01() +{ + std::map<int, int, std::less<int>, std::allocator<int>> c; +} + +// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/multimap/48101-3_neg.cc b/libstdc++-v3/testsuite/23_containers/multimap/48101-3_neg.cc new file mode 100644 index 00000000000..77769498548 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multimap/48101-3_neg.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2017-2019 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include <map> + +void +test01() +{ + std::multimap<int, int, std::less<int>, std::allocator<int>> c; +} + +// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/multiset/48101-3_neg.cc b/libstdc++-v3/testsuite/23_containers/multiset/48101-3_neg.cc new file mode 100644 index 00000000000..209a1d5deeb --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/multiset/48101-3_neg.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2017-2019 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include <set> + +void +test01() +{ + std::multiset<int, std::less<int>, std::allocator<long>> c; +} + +// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/set/48101-3_neg.cc b/libstdc++-v3/testsuite/23_containers/set/48101-3_neg.cc new file mode 100644 index 00000000000..75777370a3a --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/set/48101-3_neg.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2017-2019 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include <set> + +void +test01() +{ + std::set<int, std::less<int>, std::allocator<long>> c; +} + +// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/48101-3_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/48101-3_neg.cc new file mode 100644 index 00000000000..98bcd8c755b --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/48101-3_neg.cc @@ -0,0 +1,30 @@ +// Copyright (C) 2017-2019 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include <unordered_map> + +void +test01() +{ + using namespace std; + unordered_map<int, int, hash<int>, equal_to<int>, allocator<long>> c; +} + +// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101-3_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101-3_neg.cc new file mode 100644 index 00000000000..3bda27b8354 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/48101-3_neg.cc @@ -0,0 +1,30 @@ +// Copyright (C) 2017-2019 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include <unordered_map> + +void +test01() +{ + using namespace std; + unordered_multimap<int, int, hash<int>, equal_to<int>, allocator<long>> c; +} + +// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101-3_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101-3_neg.cc new file mode 100644 index 00000000000..620c9b703bd --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/48101-3_neg.cc @@ -0,0 +1,30 @@ +// Copyright (C) 2017-2019 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include <unordered_set> + +void +test01() +{ + using namespace std; + unordered_multiset<int, hash<int>, equal_to<int>, allocator<long>> c; +} + +// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/48101-3_neg.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/48101-3_neg.cc new file mode 100644 index 00000000000..c226c5236f8 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/48101-3_neg.cc @@ -0,0 +1,30 @@ +// Copyright (C) 2017-2019 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include <unordered_set> + +void +test01() +{ + using namespace std; + unordered_set<int, hash<int>, equal_to<int>, allocator<long>> c; +} + +// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 } diff --git a/libstdc++-v3/testsuite/23_containers/vector/48101-3_neg.cc b/libstdc++-v3/testsuite/23_containers/vector/48101-3_neg.cc new file mode 100644 index 00000000000..2317efa1516 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/vector/48101-3_neg.cc @@ -0,0 +1,29 @@ +// Copyright (C) 2017-2019 Free Software Foundation, Inc. +// +// This file is part of the GNU ISO C++ Library. This library is free +// software; you can redistribute it and/or modify it under the +// terms of the GNU General Public License as published by the +// Free Software Foundation; either version 3, or (at your option) +// any later version. + +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License along +// with this library; see the file COPYING3. If not see +// <http://www.gnu.org/licenses/>. + +// { dg-options "-std=gnu++2a" } +// { dg-do compile { target c++2a } } + +#include <vector> + +void +test01() +{ + std::vector<int, std::allocator<long>> c; +} + +// { dg-error "same value_type as its allocator" "" { target *-*-* } 0 } |