diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-05-15 15:43:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-15 15:43:07 +0200 |
commit | 9a26dff74834d6c3d9d72eac10e2f2479014ebca (patch) | |
tree | 568b06a817fedb5f226df9105f0ea8daa519a8d2 /clang/test/AST/ByteCode | |
parent | 636628d8fde45fc2bb99a1016f7503d0e744ab89 (diff) | |
download | llvm-9a26dff74834d6c3d9d72eac10e2f2479014ebca.zip llvm-9a26dff74834d6c3d9d72eac10e2f2479014ebca.tar.gz llvm-9a26dff74834d6c3d9d72eac10e2f2479014ebca.tar.bz2 |
[clang][bytecode] Check dtor calls for one-past-end pointers (#140047)
Diffstat (limited to 'clang/test/AST/ByteCode')
-rw-r--r-- | clang/test/AST/ByteCode/cxx20.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/test/AST/ByteCode/cxx20.cpp b/clang/test/AST/ByteCode/cxx20.cpp index 5f62a56..0b2234e 100644 --- a/clang/test/AST/ByteCode/cxx20.cpp +++ b/clang/test/AST/ByteCode/cxx20.cpp @@ -1007,3 +1007,11 @@ namespace TempDtor { a_ref.~A(); // both-note {{destruction of temporary is not allowed in a constant expression outside the expression that created the temporary}} } } + +namespace OnePastEndDtor { + struct A {int n; }; + constexpr void destroy_past_end() { // both-error {{never produces a constant expression}} + A a; + (&a+1)->~A(); // both-note {{destruction of dereferenced one-past-the-end pointer}} + } +} |