Skip to content

Commit c59c89c

Browse files
committed
Put [[no_unique_address]] back on the Array's array storage
MSVC has fixed the bug where [[msvc::no_unique_address]] on an array would break its alignment. Previous MSVC versions can't even compile Subspace so we don't need to worry about supporting them here.
1 parent 5f26f53 commit c59c89c

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

sus/collections/array.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,8 @@ namespace __private {
5454

5555
template <class T, size_t N>
5656
struct Storage final {
57-
sus_msvc_bug_10416202_else(
58-
[[sus_no_unique_address]]) sus::iter::IterRefCounter iter_refs_;
59-
T data_[N];
57+
[[sus_no_unique_address]] sus::iter::IterRefCounter iter_refs_;
58+
[[sus_no_unique_address]] T data_[N];
6059
};
6160

6261
template <class T>

sus/collections/invalidation_off_size_unittest.cc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ using sus::Slice;
2424

2525
constexpr usize array_padding = 0u
2626
// No support for no_unique_address in clang-cl.
27-
sus_clang_bug_49358(+sizeof(i32))
28-
// MSVC bug with no_unique_address and arrays, so not used here.
29-
sus_clang_bug_49358_else(sus_msvc_bug_10416202(+sizeof(i32)));
27+
sus_clang_bug_49358(+sizeof(i32));
3028

3129
static_assert(alignof(Array<i32, 5>) == alignof(i32));
3230
static_assert(sizeof(Array<i32, 5>) == sizeof(i32) * 5 + array_padding);

0 commit comments

Comments
 (0)