diff --git a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp index a51067896432..c87c1be6f8e9 100644 --- a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp +++ b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp @@ -1042,7 +1042,7 @@ TEST_F(TUSchedulerTests, CommandLineWarnings) { TEST(DebouncePolicy, Compute) { namespace c = std::chrono; - std::vector History = { + DebouncePolicy::clock::duration History[] = { c::seconds(0), c::seconds(5), c::seconds(10), @@ -1053,8 +1053,9 @@ TEST(DebouncePolicy, Compute) { Policy.Max = c::seconds(25); // Call Policy.compute(History) and return seconds as a float. auto Compute = [&](llvm::ArrayRef History) { - using FloatingSeconds = c::duration; - return static_cast(Policy.compute(History) / FloatingSeconds(1)); + return c::duration_cast>( + Policy.compute(History)) + .count(); }; EXPECT_NEAR(10, Compute(History), 0.01) << "(upper) median = 10"; Policy.RebuildRatio = 1.5;