@@ -727,7 +727,15 @@ TYPED_TEST(stringTyped_test, UnsafeAssignCStringOfSizeCapaResultsInSizeCapa)
727727 using MyString = typename TestFixture::stringType;
728728 constexpr auto STRINGCAP = MyString::capacity ();
729729 std::vector<char > testCharstring (STRINGCAP, ' M' );
730+ #if (defined(__GNUC__))
731+ #pragma GCC diagnostic push
732+ #pragma GCC diagnostic ignored "-Warray-bounds"
733+ #pragma GCC diagnostic ignored "-Wstringop-overflow"
734+ #endif
730735 testCharstring.emplace_back (' \0 ' );
736+ #if (defined(__GNUC__))
737+ #pragma GCC diagnostic pop
738+ #endif
731739 EXPECT_THAT (this ->testSubject .unsafe_assign (testCharstring.data ()), Eq (true ));
732740 EXPECT_THAT (this ->testSubject .size (), Eq (STRINGCAP));
733741}
@@ -738,7 +746,15 @@ TYPED_TEST(stringTyped_test, UnsafeAssignCStringOfSizeGreaterCapaResultsInSize0)
738746 using MyString = typename TestFixture::stringType;
739747 constexpr auto STRINGCAP = MyString::capacity ();
740748 std::vector<char > testCharstring (STRINGCAP + 1U , ' M' );
749+ #if (defined(__GNUC__))
750+ #pragma GCC diagnostic push
751+ #pragma GCC diagnostic ignored "-Warray-bounds"
752+ #pragma GCC diagnostic ignored "-Wstringop-overflow"
753+ #endif
741754 testCharstring.emplace_back (' \0 ' );
755+ #if (defined(__GNUC__))
756+ #pragma GCC diagnostic pop
757+ #endif
742758 EXPECT_THAT (this ->testSubject .unsafe_assign (testCharstring.data ()), Eq (false ));
743759 EXPECT_THAT (this ->testSubject .size (), Eq (0U ));
744760 EXPECT_THAT (this ->testSubject .c_str (), StrEq (" " ));
@@ -752,7 +768,15 @@ TYPED_TEST(stringTyped_test, UnsafeAssignOfInvalidCStringFails)
752768 using MyString = typename TestFixture::stringType;
753769 constexpr auto STRINGCAP = MyString::capacity ();
754770 std::vector<char > testCharstring (STRINGCAP + 1U , ' M' );
771+ #if (defined(__GNUC__))
772+ #pragma GCC diagnostic push
773+ #pragma GCC diagnostic ignored "-Warray-bounds"
774+ #pragma GCC diagnostic ignored "-Wstringop-overflow"
775+ #endif
755776 testCharstring.emplace_back (' \0 ' );
777+ #if (defined(__GNUC__))
778+ #pragma GCC diagnostic pop
779+ #endif
756780
757781 EXPECT_THAT (this ->testSubject .unsafe_assign (testCharstring.data ()), Eq (false ));
758782 EXPECT_THAT (this ->testSubject .size (), Eq (1U ));
0 commit comments