diff --git a/src/google/protobuf/compiler/cpp/helpers.h b/src/google/protobuf/compiler/cpp/helpers.h index c7eed64174..628e09fcac 100644 --- a/src/google/protobuf/compiler/cpp/helpers.h +++ b/src/google/protobuf/compiler/cpp/helpers.h @@ -383,6 +383,14 @@ bool IsLazy(const FieldDescriptor* field, const Options& options, // Is this an explicit (non-profile driven) lazy field, as denoted by // lazy/unverified_lazy in the descriptor? inline bool IsExplicitLazy(const FieldDescriptor* field) { + if (field->is_map() || field->is_repeated()) { + return false; + } + + if (field->cpp_type() != FieldDescriptor::CPPTYPE_MESSAGE) { + return false; + } + return field->options().lazy() || field->options().unverified_lazy(); }