[libcxx-commits] [libcxx] [libc++] Fix UB in <expected> related to "has value" flag (#68552) (PR #68733)
via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Oct 27 02:08:01 PDT 2023
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>,
Jan =?utf-8?q?Kokem=C3=BCller?= <jan.kokemueller at gmail.com>
Message-ID:
In-Reply-To: <llvm/llvm-project/pull/68733/libcxx at github.com>
================
@@ -43,6 +44,17 @@ constexpr bool test() {
assert(!e.has_value());
}
+ // See comments of the corresponding test in
+ // "expected.expected/observers/has_value.pass.cpp".
+ {
+ const std::expected<void, TailClobberer<1>> e(std::unexpect);
+ // clang-cl does not support [[no_unique_address]] yet.
+#if !(defined(TEST_COMPILER_CLANG) && defined(_MSC_VER))
+ static_assert(sizeof(TailClobberer<1>) == sizeof(e));
+#endif
----------------
huixie90 wrote:
`[[no_unique_address]]` is a libc++ extension to `std::expected`.
we should put this test in test/libcxx folder
(tests in test/std is meant to pass for all stl implementations)
https://github.com/llvm/llvm-project/pull/68733
More information about the libcxx-commits
mailing list