Skip to content

Commit

Permalink
Use constexpr for FieldTypeClass (#9434)
Browse files Browse the repository at this point in the history
Otherwise in C++20 / VisualStudio 2022 the following warning is emitted:

```
warning C5054: operator '*': deprecated between enumerations of different types
```
  • Loading branch information
gjasny committed Jan 21, 2022
1 parent a03ff9c commit e554bd6
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/google/protobuf/generated_message_table_driven.h
Expand Up @@ -103,13 +103,11 @@ struct PROTOBUF_EXPORT FieldMetadata {
};
// C++ protobuf has 20 fundamental types, were we added Cord and StringPiece
// and also distinguish the same types if they have different wire format.
enum {
kCordType = 19,
kStringPieceType = 20,
kInlinedType = 21,
kNumTypes = 21,
kSpecial = kNumTypes * kNumTypeClasses,
};
static constexpr auto kCordType = 19;
static constexpr auto kStringPieceType = 20;
static constexpr auto kInlinedType = 21;
static constexpr auto kNumTypes = 21;
static constexpr auto kSpecial = kNumTypes * kNumTypeClasses;

static int CalculateType(int fundamental_type, FieldTypeClass type_class);
};
Expand Down

0 comments on commit e554bd6

Please sign in to comment.