diff --git a/src/google/protobuf/descriptor.cc b/src/google/protobuf/descriptor.cc index 08870ccac099b..901f883874ba8 100644 --- a/src/google/protobuf/descriptor.cc +++ b/src/google/protobuf/descriptor.cc @@ -7737,7 +7737,8 @@ void DescriptorBuilder::ValidateOptions(const FieldDescriptor* field, // The following check is temporarily OSS only till we fix all affected // google3 TAP tests. - if (field->options().has_ctype()) { + if (field->file()->edition() >= Edition::EDITION_2023 && + field->options().has_ctype()) { if (field->cpp_type() != FieldDescriptor::CPPTYPE_STRING) { AddError( field->full_name(), proto, DescriptorPool::ErrorCollector::TYPE, diff --git a/src/google/protobuf/descriptor_unittest.cc b/src/google/protobuf/descriptor_unittest.cc index f0b6eef050004..de25e35476ba8 100644 --- a/src/google/protobuf/descriptor_unittest.cc +++ b/src/google/protobuf/descriptor_unittest.cc @@ -2957,6 +2957,9 @@ TEST_F(MiscTest, InvalidFieldOptions) { FileDescriptorProto file_proto; file_proto.set_name("foo.proto"); + file_proto.set_syntax("editions"); + file_proto.set_edition(Edition::EDITION_2023); + DescriptorProto* message_proto = AddMessage(&file_proto, "TestMessage"); AddField(message_proto, "foo", 1, FieldDescriptorProto::LABEL_OPTIONAL, FieldDescriptorProto::TYPE_INT32);