You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
chromium/chromium-95-BitstreamReader...

42 lines
1.6 KiB

3 years ago
From c23f09d436b566934d02c26a19e3cf5d31545855 Mon Sep 17 00:00:00 2001
From: Stephan Hartmann <stha09@googlemail.com>
Date: Sat, 4 Sep 2021 17:02:00 +0000
Subject: [PATCH] GCC: fix template specialization in webrtc::BitstreamReader
GCC complains that explicit specialization in non-namespace scope
is happening for webrtc::BitstreamReader::Read(). However, specialization
for bool isn't used because std::is_unsigned<bool>::value returns true.
Add std::is_same for bool check and enable second specialization only
for bool types.
---
third_party/webrtc/rtc_base/bitstream_reader.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/third_party/webrtc/rtc_base/bitstream_reader.h b/third_party/webrtc/rtc_base/bitstream_reader.h
index 8c0f66f..cd8537f 100644
--- a/third_party/webrtc/rtc_base/bitstream_reader.h
+++ b/third_party/webrtc/rtc_base/bitstream_reader.h
@@ -61,14 +61,16 @@ class BitstreamReader {
// Reads unsigned integer of fixed width.
template <typename T,
typename std::enable_if<std::is_unsigned<T>::value &&
+ !std::is_same<T, bool>::value &&
sizeof(T) <= 8>::type* = nullptr>
ABSL_MUST_USE_RESULT T Read() {
return rtc::dchecked_cast<T>(ReadBits(sizeof(T) * 8));
}
// Reads single bit as boolean.
- template <>
- ABSL_MUST_USE_RESULT bool Read<bool>() {
+ template <typename T,
+ typename std::enable_if<std::is_same<T, bool>::value>::type* = nullptr>
+ ABSL_MUST_USE_RESULT bool Read() {
return ReadBit() != 0;
}
--
2.32.0