[PATCH] D55777: [libcxx] Portability fix: add missing includes and static_casts.

Marshall Clow via Phabricator reviews at reviews.llvm.org
Tue Dec 18 07:44:17 PST 2018


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

The includes look fine. The `static_cast`s (as always) look ugly. Once you make the changes that I've requested, you can commit this.



================
Comment at: test/std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp:114
         const char str[] = "123";
-        ios.setf(0, ios.basefield);
+        ios.setf(static_cast<std::ios_base::fmtflags>(0), ios.basefield);
         std::ios_base::iostate err = ios.goodbit;
----------------
Don't repeat this over and over.
Declare a `const std::ios_base::fmtflags` and initialize it once.


================
Comment at: test/std/strings/c.strings/cwctype.pass.cpp:95
+    std::wctrans_t wctr = static_cast<std::wctrans_t>(0);
+    std::wctype_t wct = static_cast<std::wctype_t>(0);
     static_assert((std::is_same<decltype(std::iswalnum(w)), int>::value), "");
----------------
This is really ugly.  I find it hard to believe that any implementation would force this on it's users.

In any case, we don't actually need to initialize these variables at all.
Really, this test should be rewritten to use `ASSERT_SAME_TYPE` and `declval`

Just drop this change from the patch, and I'll fix up this test myself.



Repository:
  rCXX libc++

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

https://reviews.llvm.org/D55777





More information about the libcxx-commits mailing list