https://bugs.llvm.org/show_bug.cgi?id=41226

            Bug ID: 41226
           Summary: __builtin_wmemchr does not work with clang-cl
           Product: clang
           Version: 8.0
          Hardware: PC
                OS: other
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: C++'17
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

int main()
{

static_assert(__has_feature(cxx_constexpr_string_builtins));  // is true
static_assert(__has_builtin(__builtin_wmemchr));  // is true

static_assert(!__builtin_wmemchr(nullptr, 0, 0));  // is true
__builtin_wmemchr(nullptr, 0, 0);  // no error reported

}

This program does not compile.

link.exe reports this error:
LNK2019 unresolved external symbol _wmemchr referenced in function _main

lld-link.exe reports this error:
undefined symbol: _wmemchr

This issue is related to Bug 37911
(https://bugs.llvm.org/show_bug.cgi?id=37911#c1) reported by Stephan Lavavej
from Microsoft.

It seems that if __builtin_wmemchr is not forced to be evaluated at compile
time it is not "called" and clang emits the symbol _wmemchr instead. But
Microsoft's libraries do not have that symbol.

I think this is a bug. clang should be able to "call" its builtin function at
both compile time and run-time.

Maybe this is a leftover from previous clang versions, that is, before wmemchr
was made constexpr and builtin?

I tested this in VS 2017 and 2019 RC with the LLVM Compiler Toolchain
extension.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to