[llvm-bugs] [Bug 27214] New: call to 'wcsrchr' is ambiguous

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Apr 5 05:37:56 PDT 2016


            Bug ID: 27214
           Summary: call to 'wcsrchr' is ambiguous
           Product: libc++
           Version: unspecified
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: radek.brich at gmail.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com
    Classification: Unclassified

Hi, I've encounter an error which seems to be problem inside libc++.

When including <cwchar>, I'm getting two conflicting wcsrchr() functions, one
in std and the other in global namespace. This causes error when "using
namespace std" - see example bellow.

// wcsrchr_test.cc
#include <cwchar>

int main()
    const wchar_t * str = L"hello world";

    std::wcsrchr(str, 'w');  // OK
    ::wcsrchr(str, 'w');  // OK
    wcsrchr(str, 'w');  // OK

    using namespace std;
    std::wcsrchr(str, 'w');  // OK
    ::wcsrchr(str, 'w');  // OK
    wcsrchr(str, 'w');  // error: call to 'wcsrchr' is ambiguous

wcsrchr_test.cc:14:5: error: call to 'wcsrchr' is ambiguous
    wcsrchr(str, 'w');  // error: call to 'wcsrchr' is ambiguous
/usr/include/wchar.h:137:10: note: candidate function
wchar_t *wcsrchr(const wchar_t *, wchar_t);
note: candidate function
inline _LIBCPP_INLINE_VISIBILITY const wchar_t* wcsrchr(const wchar_t* __s,
wchar_t __c) {return ::wcsrchr(__s, __c);}
1 error generated.

Tested on OSX 10.11.3, /usr/lib/libc++.1.dylib (compatibility version 1.0.0,
current version 120.1.0)

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160405/9f4d1113/attachment-0001.html>

More information about the llvm-bugs mailing list