diff --git a/src/google/protobuf/reflection_tester.cc b/src/google/protobuf/reflection_tester.cc index 6c1cd3d849..45c6f47f9e 100644 --- a/src/google/protobuf/reflection_tester.cc +++ b/src/google/protobuf/reflection_tester.cc @@ -27,9 +27,10 @@ // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - #include "google/protobuf/reflection_tester.h" +#include + #include #include "absl/container/flat_hash_map.h" #include "google/protobuf/map_field.h" @@ -1235,9 +1236,9 @@ void MapReflectionTester::ExpectMapFieldsSetViaReflection( } } { - absl::flat_hash_map map; - map[false] = false; - map[true] = true; + std::array map; + map[0] = false; + map[1] = true; std::vector keys = {false, true}; std::vector vals = {false, true}; for (int i = 0; i < 2; i++) { @@ -1252,7 +1253,7 @@ void MapReflectionTester::ExpectMapFieldsSetViaReflection( map_bool_bool_key_); bool val = sub_message->GetReflection()->GetBool(*sub_message, map_bool_bool_val_); - EXPECT_EQ(map[key], val); + EXPECT_EQ(map[key ? 1 : 0], val); } else { // Check with Map Reflection map_key.SetBoolValue(keys[i]); @@ -1542,12 +1543,12 @@ void MapReflectionTester::ExpectMapFieldsSetViaReflectionIterator( } } { - absl::flat_hash_map map; - map[false] = false; - map[true] = true; + std::array map; + map[0] = false; + map[1] = true; for (MapIterator iter = reflection->MapBegin(message, F("map_bool_bool")); iter != reflection->MapEnd(message, F("map_bool_bool")); ++iter) { - EXPECT_EQ(map[iter.GetKey().GetBoolValue()], + EXPECT_EQ(map[iter.GetKey().GetBoolValue() ? 1 : 0], iter.GetValueRef().GetBoolValue()); } }