diff options
author | kpayson64 <kpayson@google.com> | 2018-05-11 12:20:11 -0700 |
---|---|---|
committer | kpayson64 <kpayson@google.com> | 2018-05-11 12:20:11 -0700 |
commit | 4fad281ce8affe27fb7428f264d2c3b9dfc45f2f (patch) | |
tree | ca96c9efd69afec56aa2e5fe072a9f758247d0a3 /test/core/gprpp | |
parent | ec445cc2bb270ed4acb1c710c3533fca14a50019 (diff) | |
parent | 61fdb46ac456027c79841949272ec540f66d2317 (diff) |
Merge remote-tracking branch 'upstream/master' into fork_exec_ctx_check
Diffstat (limited to 'test/core/gprpp')
-rw-r--r-- | test/core/gprpp/inlined_vector_test.cc | 8 | ||||
-rw-r--r-- | test/core/gprpp/ref_counted_ptr_test.cc | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/test/core/gprpp/inlined_vector_test.cc b/test/core/gprpp/inlined_vector_test.cc index b900afaf3d..ae34947718 100644 --- a/test/core/gprpp/inlined_vector_test.cc +++ b/test/core/gprpp/inlined_vector_test.cc @@ -33,6 +33,7 @@ TEST(InlinedVectorTest, CreateAndIterate) { EXPECT_EQ(static_cast<size_t>(kNumElements), v.size()); for (int i = 0; i < kNumElements; ++i) { EXPECT_EQ(i, v[i]); + EXPECT_EQ(i, &v[i] - &v[0]); // Ensure contiguous allocation. } } @@ -87,14 +88,17 @@ TEST(InlinedVectorTest, ClearAndRepopulate) { } TEST(InlinedVectorTest, ConstIndexOperator) { - const int kNumElements = 10; + constexpr int kNumElements = 10; InlinedVector<int, 5> v; EXPECT_EQ(0UL, v.size()); for (int i = 0; i < kNumElements; ++i) { v.push_back(i); EXPECT_EQ(i + 1UL, v.size()); } - auto const_func = [kNumElements](const InlinedVector<int, 5>& v) { + // The following lambda function is exceptionally allowed to use an anonymous + // capture due to the erroneous behavior of the MSVC compiler, that refuses to + // capture the kNumElements constexpr, something allowed by the standard. + auto const_func = [&](const InlinedVector<int, 5>& v) { for (int i = 0; i < kNumElements; ++i) { EXPECT_EQ(i, v[i]); } diff --git a/test/core/gprpp/ref_counted_ptr_test.cc b/test/core/gprpp/ref_counted_ptr_test.cc index 2e398a7722..c810345166 100644 --- a/test/core/gprpp/ref_counted_ptr_test.cc +++ b/test/core/gprpp/ref_counted_ptr_test.cc @@ -88,7 +88,7 @@ TEST(RefCountedPtr, CopyAssignmentWhenEmpty) { TEST(RefCountedPtr, CopyAssignmentToSelf) { RefCountedPtr<Foo> foo(New<Foo>()); - foo = foo; + foo = *&foo; // The "*&" avoids warnings from LLVM -Wself-assign. } TEST(RefCountedPtr, EnclosedScope) { |