Fix QuicVersion MSVC compilation for Envoy Envoy reported a compilation issue with MSVC: https://github.com/envoyproxy/envoy/issues/10239 It appears that what we were doing before was technically undefined C++ behavior, so this CL switches use to using initialization lists which are allowed since C++11. This fix was developed thanks to Godbolt: https://godbolt.org/z/2jcJC4 gfe-relnote: n/a, no behavior change, not flag protected PiperOrigin-RevId: 301199417 Change-Id: I00aedb74d5699001cab023adaba9cc1114c53f17
diff --git a/quic/core/quic_versions.h b/quic/core/quic_versions.h index e07e24a..3a37091 100644 --- a/quic/core/quic_versions.h +++ b/quic/core/quic_versions.h
@@ -319,19 +319,22 @@ // // See go/new-quic-version for more details on how to roll out new versions. constexpr std::array<QuicTransportVersion, 7> SupportedTransportVersions() { - return std::array<QuicTransportVersion, 7>( - {QUIC_VERSION_IETF_DRAFT_27, QUIC_VERSION_IETF_DRAFT_25, QUIC_VERSION_50, - QUIC_VERSION_49, QUIC_VERSION_48, QUIC_VERSION_46, QUIC_VERSION_43}); + return {QUIC_VERSION_IETF_DRAFT_27, + QUIC_VERSION_IETF_DRAFT_25, + QUIC_VERSION_50, + QUIC_VERSION_49, + QUIC_VERSION_48, + QUIC_VERSION_46, + QUIC_VERSION_43}; } // This vector contains all crypto handshake protocols that are supported. constexpr std::array<HandshakeProtocol, 2> SupportedHandshakeProtocols() { - return std::array<HandshakeProtocol, 2>( - {PROTOCOL_QUIC_CRYPTO, PROTOCOL_TLS1_3}); + return {PROTOCOL_QUIC_CRYPTO, PROTOCOL_TLS1_3}; } constexpr std::array<ParsedQuicVersion, 8> SupportedVersions() { - return std::array<ParsedQuicVersion, 8>({ + return { ParsedQuicVersion(PROTOCOL_QUIC_CRYPTO, QUIC_VERSION_50), ParsedQuicVersion(PROTOCOL_QUIC_CRYPTO, QUIC_VERSION_49), ParsedQuicVersion(PROTOCOL_QUIC_CRYPTO, QUIC_VERSION_48), @@ -340,7 +343,7 @@ ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_IETF_DRAFT_27), ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_IETF_DRAFT_25), ParsedQuicVersion(PROTOCOL_TLS1_3, QUIC_VERSION_50), - }); + }; } using QuicTransportVersionVector = std::vector<QuicTransportVersion>;