[PATCH] D61365: [libcxx] [test] Suppress float->int narrowing warning in vector range-construction test.

Casey Carter via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 7 00:03:13 PDT 2019


CaseyCarter added inline comments.


================
Comment at: test/std/containers/sequences/vector/vector.cons/construct_iter_iter.pass.cpp:159
     float array[3] = {0.0f, 1.0f, 2.0f};
+#pragma warning(suppress: 4244) // narrowing float to int
     std::vector<int> v(array, array + 3);
----------------
BillyONeal wrote:
> CaseyCarter wrote:
> > This will blow up non-MSVC-ish when running the test suite with `-Wall -W -Werror` (which is typical). I suggest wrapping in `#ifdef _MSC_VER`.
> Why didn't it blow up on Contest then? clang-cl is happy with it?
clang-cl is the "ish" in my "MSVC-ish" (MSVC and compilers emulating MSVC). GCC and clang-without-`-fms-compatibility` when compiling with `-Wall` warn about unrecognized pragmas, just as does cl in default mode (https://godbolt.org/z/Chue0L).


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

https://reviews.llvm.org/D61365





More information about the cfe-commits mailing list