aboutsummaryrefslogtreecommitdiff
path: root/clang/test/AST/ByteCode/builtin-functions.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-03-17 19:02:55 +0100
committerGitHub <noreply@github.com>2025-03-17 19:02:55 +0100
commitcfa07ccdfcf03cbd48086fe9988f97e3a776b02c (patch)
tree3fee4ef7540836b3ea751f079b960070c8030044 /clang/test/AST/ByteCode/builtin-functions.cpp
parentca1bde0b91a6129e7bacee0fa67e4331b06dd683 (diff)
downloadllvm-cfa07ccdfcf03cbd48086fe9988f97e3a776b02c.zip
llvm-cfa07ccdfcf03cbd48086fe9988f97e3a776b02c.tar.gz
llvm-cfa07ccdfcf03cbd48086fe9988f97e3a776b02c.tar.bz2
[clang][bytecode] Fix builtin_memchr with non-0 start index (#131633)
Diffstat (limited to 'clang/test/AST/ByteCode/builtin-functions.cpp')
-rw-r--r--clang/test/AST/ByteCode/builtin-functions.cpp5
1 files changed, 5 insertions, 0 deletions
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 {