This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: PR 58148 patch
- From: Paolo Carlini <paolo dot carlini at oracle dot com>
- To: François Dumont <frs dot dumont at gmail dot com>
- Cc: "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Date: Mon, 26 Aug 2013 22:40:47 +0200
- Subject: Re: PR 58148 patch
- Authentication-results: sourceware.org; auth=none
- References: <521BB025 dot 3040700 at gmail dot com>
On 08/26/2013 09:44 PM, François Dumont wrote:
Hi
The problem exposed in PR 58148 is quite trivial, std::common_type
cannot find a result when instantiated with char* and const wchar_t*.
The attached patch will fix this problem by dealing with a
std::common_type resolution failure even if the drawback is that
following call won't be detected as an invalid one anymore:
std::vector<int> v;
....
v.insert(v.begin(), reinterpret_cast<char*>(v.data() + 1),
reinterpret_cast<char*>(v.data() + 5)); // Expected failure
For the time being I think we should simply live with this. To be
honest, I think that at this level even the very idea of using
common_type (and relying on the very recent sfinae-friendly feature) is
a bit too much, I would just return true if the type of
addressof(*__other) != container::pointer (modulo const). Thus have a
__foreign_iterator_aux4 taking two container::const_pointer and a fall
back always returning true.
Paolo.