diff options
author | Timm Baeder <tbaeder@redhat.com> | 2025-07-18 11:10:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-18 11:10:57 +0200 |
commit | 3bb4355bb83692d9c859043076db16baa86431e1 (patch) | |
tree | ce0372ea5ff4a44d2d314dea9cd46cd153eab9b3 /clang/test/AST/ByteCode | |
parent | 0b7a95a6fd81b31634a3723a0bea6d9d91bbc230 (diff) | |
download | llvm-3bb4355bb83692d9c859043076db16baa86431e1.zip llvm-3bb4355bb83692d9c859043076db16baa86431e1.tar.gz llvm-3bb4355bb83692d9c859043076db16baa86431e1.tar.bz2 |
[clang][bytecode] Report mutable reads when copying unions (#149320)
Diffstat (limited to 'clang/test/AST/ByteCode')
-rw-r--r-- | clang/test/AST/ByteCode/unions.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/AST/ByteCode/unions.cpp b/clang/test/AST/ByteCode/unions.cpp index 0fa44a25..7cfd0d6 100644 --- a/clang/test/AST/ByteCode/unions.cpp +++ b/clang/test/AST/ByteCode/unions.cpp @@ -847,6 +847,20 @@ namespace Activation2 { } static_assert(change_member_indirectly() == 4); } + +namespace CopyCtorMutable { + struct E { + union { // expected-note {{read of mutable member 'b'}} + int a; + mutable int b; // both-note {{here}} + }; + }; + constexpr E e1 = {{1}}; + constexpr E e2 = e1; // both-error {{constant}} \ + // ref-note {{read of mutable member 'b'}} \ + // both-note {{in call}} +} + #endif namespace AddressComparison { |