From cfa07ccdfcf03cbd48086fe9988f97e3a776b02c Mon Sep 17 00:00:00 2001 From: Timm Baeder Date: Mon, 17 Mar 2025 19:02:55 +0100 Subject: [clang][bytecode] Fix builtin_memchr with non-0 start index (#131633) --- clang/test/AST/ByteCode/builtin-functions.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'clang/test/AST/ByteCode/builtin-functions.cpp') diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp index 2981255..11ff48b 100644 --- a/clang/test/AST/ByteCode/builtin-functions.cpp +++ b/clang/test/AST/ByteCode/builtin-functions.cpp @@ -1459,6 +1459,11 @@ namespace Memchr { constexpr bool b = !memchr("hello", 'h', 3); // both-error {{constant expression}} \ // both-note {{non-constexpr function 'memchr' cannot be used in a constant expression}} + constexpr bool f() { + const char *c = "abcdef"; + return __builtin_char_memchr(c + 1, 'f', 1) == nullptr; + } + static_assert(f()); } namespace Strchr { -- cgit v1.1