소스 검색

[libc++][test] Silence MSVC warning in std::optional test

`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`).

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@374684 91177308-0d34-0410-b5e6-96231b3b80d8
Casey Carter 5 년 전
부모
커밋
1f4cad9f28
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      test/std/utilities/optional/optional.specalg/make_optional_explicit.pass.cpp

+ 1 - 1
test/std/utilities/optional/optional.specalg/make_optional_explicit.pass.cpp

@@ -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");
     }