aboutsummaryrefslogtreecommitdiff
path: root/clang/test/AST/ByteCode/builtin-functions.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2024-12-09 16:57:49 +0100
committerGitHub <noreply@github.com>2024-12-09 16:57:49 +0100
commit6168739f00616f34354e0b34852398aeced98f53 (patch)
treef2ec1c283b844800c14c12c75d3b01df66cdbf64 /clang/test/AST/ByteCode/builtin-functions.cpp
parent664a226bf616a7dd6e1934cf45f84f1d99e8fed0 (diff)
downloadllvm-6168739f00616f34354e0b34852398aeced98f53.zip
llvm-6168739f00616f34354e0b34852398aeced98f53.tar.gz
llvm-6168739f00616f34354e0b34852398aeced98f53.tar.bz2
[clang][bytecode] Reject memcpy sizes with element size remainder (#119209)
Diffstat (limited to 'clang/test/AST/ByteCode/builtin-functions.cpp')
-rw-r--r--clang/test/AST/ByteCode/builtin-functions.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp
index bd453d6..a67b6b6 100644
--- a/clang/test/AST/ByteCode/builtin-functions.cpp
+++ b/clang/test/AST/ByteCode/builtin-functions.cpp
@@ -1197,4 +1197,14 @@ namespace BuiltinMemcpy {
return b;
}
static_assert(simpleMove() == 12);
+
+ constexpr int memcpyTypeRem() { // ref-error {{never produces a constant expression}}
+ int a = 12;
+ int b = 0;
+ __builtin_memmove(&b, &a, 1); // both-note {{'memmove' not supported: size to copy (1) is not a multiple of size of element type 'int'}} \
+ // ref-note {{not supported}}
+ return b;
+ }
+ static_assert(memcpyTypeRem() == 12); // both-error {{not an integral constant expression}} \
+ // both-note {{in call to}}
}