This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/72792] New: allocator_traits is too strict about rebinding
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 03 Aug 2016 14:52:43 +0000
- Subject: [Bug libstdc++/72792] New: allocator_traits is too strict about rebinding
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=72792
Bug ID: 72792
Summary: allocator_traits is too strict about rebinding
Product: gcc
Version: 6.1.1
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Target Milestone: ---
#include <memory>
template<typename T, int = 0>
struct Alloc {
using value_type = T;
T* allocate(std::size_t n) { throw std::bad_alloc(); }
void deallocate(T*, std::size_t n) { }
};
std::allocator_traits<Alloc<int>>::pointer p;
/home/jwakely/gcc/7/include/c++/7.0.0/bits/alloc_traits.h: In instantiation of
‘struct std::allocator_traits<Alloc<int> >’:
alloc.cc:11:34: required from here
/home/jwakely/gcc/7/include/c++/7.0.0/bits/alloc_traits.h:187:7: error: static
assertion failed: allocator defines rebind or is like Alloc<T, Args>
static_assert(!is_same<rebind_alloc<value_type>, __undefined>::value,
^~~~~~~~~~~~~
The standard says that the instantiation of allocator_traits<Alloc<T,
int>>::rebind_alloc should be ill-formed, but the assertion fires even when it
isn't instantiated.