diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-03-24 12:44:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-03-24 12:44:35 +0100 |
commit | 9ab3b6a006d8b5c831146eb8a7f0a8df616bd5ad (patch) | |
tree | 306779b76ca769d51a8a596e28e6683051cccf4c /clang/test/AST/ByteCode/builtin-functions.cpp | |
parent | bf2d30e0927b6b137bf4cc7bf32cd74d8092b0ee (diff) | |
download | llvm-9ab3b6a006d8b5c831146eb8a7f0a8df616bd5ad.zip llvm-9ab3b6a006d8b5c831146eb8a7f0a8df616bd5ad.tar.gz llvm-9ab3b6a006d8b5c831146eb8a7f0a8df616bd5ad.tar.bz2 |
[clang][bytecode] Diagnose integral source/dest in memcpy (#132715)
Like the current interpreter does.
Diffstat (limited to 'clang/test/AST/ByteCode/builtin-functions.cpp')
-rw-r--r-- | clang/test/AST/ByteCode/builtin-functions.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp index c3ea158..8cba1ec 100644 --- a/clang/test/AST/ByteCode/builtin-functions.cpp +++ b/clang/test/AST/ByteCode/builtin-functions.cpp @@ -1290,6 +1290,12 @@ namespace BuiltinMemcpy { return Result1 && Result2; } static_assert(memmoveOverlapping()); + +#define fold(x) (__builtin_constant_p(0) ? (x) : (x)) + static_assert(__builtin_memcpy(&global, fold((wchar_t*)123), sizeof(wchar_t))); // both-error {{not an integral constant expression}} \ + // both-note {{source of 'memcpy' is (void *)123}} + static_assert(__builtin_memcpy(fold(reinterpret_cast<wchar_t*>(123)), &global, sizeof(wchar_t))); // both-error {{not an integral constant expression}} \ + // both-note {{destination of 'memcpy' is (void *)123}} } namespace Memcmp { |