diff --git a/source/meta.tex b/source/meta.tex index 48510a4e39..5da7f5f9c6 100644 --- a/source/meta.tex +++ b/source/meta.tex @@ -2867,10 +2867,11 @@ struct OptBool { union { bool b; char c; }; - // note: this assumes common implementation properties for \tcode{bool} and \tcode{char}: - // * \tcode{sizeof(bool) == sizeof(char)}, and + // note: this assumes common implementation properties for \tcode{bool}: + // * \tcode{bool} has the same object representation, value representation, and + // alignment requirements as \tcode{unsigned char}, and // * the value representations for \tcode{true} and \tcode{false} are distinct - // from the value representation for \tcode{2} + // from the value representation for \tcode{char\{2\}} constexpr OptBool() : c(2) { } constexpr OptBool(bool b) : b(b) { } @@ -2878,7 +2879,7 @@ if consteval { return std::is_within_lifetime(&b); // during constant evaluation, cannot read from \tcode{c} } else { - return c != 2; // during runtime, must read from \tcode{c} + return std::bit_cast(*this) != 2; // during runtime, must read the value representation } }