PR 58148 patch

François Dumont frs.dumont@gmail.com
Mon Aug 26 19:44:00 GMT 2013


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

     So I wonder why we can't simply use std::less<const volatile void*> 
and std::greater_equal<const volatile void*> ? Would there be any 
portability issue ? I remember that in the past a function pointer could 
not be casted to void* but I don't think it is still true. And even if 
it is so I can simply check that the result of the std::addressof call 
can be passed transparently as const volatile void*.

François

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 58148.patch
Type: text/x-patch
Size: 1757 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20130826/a62158c7/attachment.bin>


More information about the Libstdc++ mailing list