[libc++][test] Silence MSVC warning in std::optional test
authorCasey Carter <Casey@Carter.net>
Sat, 12 Oct 2019 19:01:46 +0000 (19:01 +0000)
committerCasey Carter <Casey@Carter.net>
Sat, 12 Oct 2019 19:01:46 +0000 (19:01 +0000)
`make_optional<string>(4, 'X')` passes `4` (an `int`) as the first argument to `string`'s `(size_t, charT)` constructor, triggering a signed/unsigned mismatch warning when compiling with MSVC at `/W4`. The incredibly simple fix is to instead use an unsigned literal (`4u`).

llvm-svn: 374684

libcxx/test/std/utilities/optional/optional.specalg/make_optional_explicit.pass.cpp

index e736eb4..3a9aec8 100644 (file)
@@ -40,7 +40,7 @@ int main(int, char**)
         assert(s == nullptr);
     }
     {
-        auto opt = make_optional<std::string>(4, 'X');
+        auto opt = make_optional<std::string>(4u, 'X');
         assert(*opt == "XXXX");
     }