Initialize `static constexpr` tag members in `structured_headers.h`
Add `{}` direct-list-initializers to the `string`, `token`, and `byte_sequence`
tag members in `Item` and `ItemView`, and drop the redundant `inline` specifier
since `static constexpr` class members are implicitly `inline` since C++17.
C++ requires in-class `static constexpr` members to have an explicit initializer
(`{}` or `= ...`), even for empty structs. Clang accepts omitting it as an
extension, but GCC rejects it.
PiperOrigin-RevId: 986290500
diff --git a/quiche/common/structured_headers.h b/quiche/common/structured_headers.h
index 55a6b96..f8503c4 100644
--- a/quiche/common/structured_headers.h
+++ b/quiche/common/structured_headers.h
@@ -74,17 +74,17 @@
struct string_t {
constexpr explicit string_t() = default;
};
- inline static constexpr string_t string;
+ static constexpr string_t string{};
struct token_t {
constexpr explicit token_t() = default;
};
- inline static constexpr token_t token;
+ static constexpr token_t token{};
struct byte_sequence_t {
constexpr explicit byte_sequence_t() = default;
};
- inline static constexpr byte_sequence_t byte_sequence;
+ static constexpr byte_sequence_t byte_sequence{};
Item();
explicit Item(int64_t value);
@@ -446,9 +446,9 @@
using token_t = Item::token_t;
using byte_sequence_t = Item::byte_sequence_t;
- inline static constexpr string_t string;
- inline static constexpr token_t token;
- inline static constexpr byte_sequence_t byte_sequence;
+ static constexpr string_t string{};
+ static constexpr token_t token{};
+ static constexpr byte_sequence_t byte_sequence{};
ItemView();
ItemView(int64_t value);