Skip to content

Commit d1875e4

Browse files
committed
Assert NeverValueField directly in choice tests
1 parent 0673556 commit d1875e4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

subspace/choice/choice_unittest.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,14 @@ TEST(Choice, NeverValue) {
6565
using One =
6666
Choice<sus_choice_types((Order::First, u64), (Order::Second, u32))>;
6767
static_assert(std::is_standard_layout_v<One>);
68+
static_assert(sus::mem::NeverValueField<One>);
6869
static_assert(sizeof(sus::Option<One>) == sizeof(One));
6970

7071
// It used to be that Option<T> did not support the NeverValueField
7172
// optimization for non-Standard-Layout types, but it does now.
7273
using Two = Choice<sus_choice_types((Order::First, u64, u64))>;
7374
static_assert(!std::is_standard_layout_v<Two>);
75+
static_assert(sus::mem::NeverValueField<Two>);
7476
static_assert(sizeof(sus::Option<Two>) == sizeof(Two));
7577
}
7678

0 commit comments

Comments
 (0)