Use constexpr for FieldTypeClass (#9434)

Otherwise in C++20 / VisualStudio 2022 the following warning is emitted:

```
warning C5054: operator '*': deprecated between enumerations of different types
```
This commit is contained in:
Gregor Jasny 2022-01-22 00:38:59 +01:00 committed by GitHub
parent a03ff9c3e8
commit e554bd6cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -103,13 +103,11 @@ struct PROTOBUF_EXPORT FieldMetadata {
}; };
// C++ protobuf has 20 fundamental types, were we added Cord and StringPiece // C++ protobuf has 20 fundamental types, were we added Cord and StringPiece
// and also distinguish the same types if they have different wire format. // and also distinguish the same types if they have different wire format.
enum { static constexpr auto kCordType = 19;
kCordType = 19, static constexpr auto kStringPieceType = 20;
kStringPieceType = 20, static constexpr auto kInlinedType = 21;
kInlinedType = 21, static constexpr auto kNumTypes = 21;
kNumTypes = 21, static constexpr auto kSpecial = kNumTypes * kNumTypeClasses;
kSpecial = kNumTypes * kNumTypeClasses,
};
static int CalculateType(int fundamental_type, FieldTypeClass type_class); static int CalculateType(int fundamental_type, FieldTypeClass type_class);
}; };