GCC: fix template specialization in webrtc::BitstreamReader
GCC complains that explicit specialization in non-namespace scope is happening for webrtc::BitstreamReader::Read(). However, specializationvfor 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. Bug: chromium:819294 Change-Id: I1873cd59e2737516bd4012fb952da65d6bf3172b Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/231561 Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/main@{#35007}
This commit is contained in:
parent
b6b29030f6
commit
3987e61086
@ -61,14 +61,17 @@ 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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user