diff options
author | Timm Baeder <tbaeder@redhat.com> | 2024-12-03 11:51:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-03 11:51:49 +0100 |
commit | 3f39c5df08d4ca1e7f852908e9fb255db24538da (patch) | |
tree | f99c9c6b56b7b1674115f700067c7e9d78e19214 /clang/test/AST/ByteCode/builtin-functions.cpp | |
parent | bdc6faf775bc52b5225013312149dfba21f88aa2 (diff) | |
download | llvm-3f39c5df08d4ca1e7f852908e9fb255db24538da.zip llvm-3f39c5df08d4ca1e7f852908e9fb255db24538da.tar.gz llvm-3f39c5df08d4ca1e7f852908e9fb255db24538da.tar.bz2 |
[clang][bytecode] Reject memcpy dummy pointers after null check (#118460)
To match the diagnostic output of the current interpreter.
Diffstat (limited to 'clang/test/AST/ByteCode/builtin-functions.cpp')
-rw-r--r-- | clang/test/AST/ByteCode/builtin-functions.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/test/AST/ByteCode/builtin-functions.cpp b/clang/test/AST/ByteCode/builtin-functions.cpp index 211ca6e..b951c04 100644 --- a/clang/test/AST/ByteCode/builtin-functions.cpp +++ b/clang/test/AST/ByteCode/builtin-functions.cpp @@ -1169,6 +1169,10 @@ namespace BuiltinMemcpy { static_assert(__builtin_memcpy(null_incomplete, null_incomplete, sizeof(wchar_t))); // both-error {{not an integral constant expression}} \ // both-note {{source of 'memcpy' is nullptr}} + wchar_t global; + constexpr wchar_t *null = 0; + static_assert(__builtin_memcpy(&global, null, sizeof(wchar_t))); // both-error {{not an integral constant expression}} \ + // both-note {{source of 'memcpy' is nullptr}} constexpr int simpleMove() { int a = 12; |