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
This commit is contained in:
parent
f2b00d2ba4
commit
ebaf365963
@ -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.
|
||||
|
@ -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>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
29
libstdc++-v3/testsuite/23_containers/deque/48101-3_neg.cc
Normal file
29
libstdc++-v3/testsuite/23_containers/deque/48101-3_neg.cc
Normal file
@ -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 }
|
@ -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 }
|
29
libstdc++-v3/testsuite/23_containers/list/48101-3_neg.cc
Normal file
29
libstdc++-v3/testsuite/23_containers/list/48101-3_neg.cc
Normal file
@ -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 }
|
29
libstdc++-v3/testsuite/23_containers/map/48101-3_neg.cc
Normal file
29
libstdc++-v3/testsuite/23_containers/map/48101-3_neg.cc
Normal file
@ -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 }
|
29
libstdc++-v3/testsuite/23_containers/multimap/48101-3_neg.cc
Normal file
29
libstdc++-v3/testsuite/23_containers/multimap/48101-3_neg.cc
Normal file
@ -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 }
|
29
libstdc++-v3/testsuite/23_containers/multiset/48101-3_neg.cc
Normal file
29
libstdc++-v3/testsuite/23_containers/multiset/48101-3_neg.cc
Normal file
@ -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 }
|
29
libstdc++-v3/testsuite/23_containers/set/48101-3_neg.cc
Normal file
29
libstdc++-v3/testsuite/23_containers/set/48101-3_neg.cc
Normal file
@ -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 }
|
@ -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 }
|
@ -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 }
|
@ -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 }
|
@ -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 }
|
29
libstdc++-v3/testsuite/23_containers/vector/48101-3_neg.cc
Normal file
29
libstdc++-v3/testsuite/23_containers/vector/48101-3_neg.cc
Normal file
@ -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 }
|
Loading…
Reference in New Issue
Block a user