[libcxx] r260337 - Fix overload sets of strchr, strpbrk, strrchr, memchr and strstr from

Tim Northover via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 10 10:32:50 PST 2016


Hi Richard,

On 9 February 2016 at 16:59, Richard Smith via cfe-commits
<cfe-commits at lists.llvm.org> wrote:
> Fix overload sets of strchr, strpbrk, strrchr, memchr and strstr from
> <string.h> and wcschr, wcspbrk, wcsrchr, wmemchr, and wcsstr from <wchar.h> to
> provide a const-correct overload set even when the underlying C library does
> not.

This seems to have caused breakage on one of compiler-rt's tests on
Darwin: lib/asan/test/asan_str_test.cc if I'm reading the runes
correctly. See http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA_check/10117/
for example.

I'm not quite sure what's going on, but it seems to involve enable_if
disabling some overload checks, leading to an inconsistent set of
possible functions. That's probably an independent bug in clang
(there's certainly no mangling to support it in Itanium), but I
suspect libc++ shouldn't be trying to produce such combinations
anyway.

The smallest test case with the essential Clang details I've found is:

char *foo(const char *);
char *foo(char *);
__attribute__ ((__enable_if__(true, ""))) const char *foo(const char *);

void test(char *(*)(const char *));
void test(char *(*)(char *));

void func(char *in) {
  test(&foo);
}

Do you have any ideas on what to do, because I'm a bit stuck I'm
afraid. I can give you preprocessed source if you're struggling to
reproduce the issue (it's 2.4MB for the default 7ish for
-frewrite-includes).

Cheers.

Tim.


More information about the cfe-commits mailing list