[Bug libstdc++/55963] std::vector<const T> fails

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Jan 13 19:05:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55963

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-13 19:04:43 UTC ---
I disagree with the claim it's required to work.  It's true that container
requirements have been relaxed so requirements on types are more fine-grained
and only apply to specific operations, but std::vector<const int> instantiates
std::allocator<const int> and that creates ambiguous overloads of
std::allocator<const int>::address(reference) and std::allocator<const
int>::address(const_reference) because reference and const_reference are the
same type.

I would argue it's required not to work, based on the explicit definition of
std::allocator given in the C++11 standard.

I've been thinking about altering std::allocator so it works though, so I'll
confirm this as an extension.



More information about the Gcc-bugs mailing list