[libcxx-commits] [PATCH] D127672: [libc++] Test the size of basic_string

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 13 13:51:50 PDT 2022


ldionne accepted this revision.
ldionne added a comment.
This revision is now accepted and ready to land.

LGTM but I'd like to add a test for alignment too, since that would be so easy.



================
Comment at: libcxx/test/libcxx/strings/basic.string/string_abi.compile.pass.cpp:9
+
+// Ensure that we never change the size of `basic_string`
+
----------------
While we're at it, I think it would be trivial to add a test for the alignment. WDYT?


================
Comment at: libcxx/test/libcxx/strings/basic.string/string_abi.compile.pass.cpp:18
+template <class CharT>
+using min_string = std::basic_string<CharT, std::char_traits<CharT>, min_allocator<CharT>>;
+
----------------
Space between `> >` here and below should help pass in C++03.


================
Comment at: libcxx/test/libcxx/strings/basic.string/string_abi.compile.pass.cpp:25
+
+static_assert(sizeof(std::string) == 24);
+static_assert(sizeof(std::wstring) == 24);
----------------
You need a dummy `, "");` message in your `static_assert` for C++11.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127672



More information about the libcxx-commits mailing list