On Fri, Feb 13, 2015 at 04:04:42PM -0000, Marshall Clow wrote:
> Modified: libcxx/trunk/include/string
> URL: 
> http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/string?rev=229119&r1=229118&r2=229119&view=diff
> ==============================================================================
> --- libcxx/trunk/include/string (original)
> +++ libcxx/trunk/include/string Fri Feb 13 10:04:42 2015
> @@ -639,16 +639,16 @@ struct _LIBCPP_TYPE_VIS_ONLY char_traits
>          {return __n == 0 ? 0 : memcmp(__s1, __s2, __n);}
>      static inline size_t length(const char_type* __s) {return strlen(__s);}
>      static inline const char_type* find(const char_type* __s, size_t __n, 
> const char_type& __a)
> -        {return (const char_type*)memchr(__s, to_int_type(__a), __n);}
> +        {return __n == 0 ? NULL : (const char_type*) memchr(__s, 
> to_int_type(__a), __n);}

Why is this undefined behavior?

Joerg
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to