[libcxx-commits] [PATCH] D75960: [libc++] Implement C++20's P0476r2: std::bit_cast

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 23 12:10:43 PDT 2021


ldionne marked 4 inline comments as done.
ldionne added inline comments.


================
Comment at: libcxx/test/std/numerics/bit/bit.cast/bit_cast.pass.cpp:49
+    assert(std::memcmp(&from, &to, sizeof(T)) == 0);
+    assert(std::memcmp(&middle, &middle2, sizeof(Nested)) == 0);
+}
----------------
curdeius wrote:
> Not sure if this adds much value, but can't you additionally test `assert(from == middle.x);`?
> Similarly for middle2.
Since I'm already testing `memcmp`, I feel like adding an equality test is not super useful. If the bytes are the same, they have to compare equal.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D75960/new/

https://reviews.llvm.org/D75960



More information about the libcxx-commits mailing list