Workaround VC++ 2017 template bug
When compiling webrtc's call.cc with VC++ 2017 (is_clang = false) the
following compile error occurs:
sequence_number_util.h(90): error C2672: 'rtc::SafeLt': no matching
overloaded function found
note: see reference to class template instantiation
'webrtc::SeqNumUnwrapper<T,M>' being compiled
This error is not associated with any particular instantiation of
SeqNumUnwrapper (there isn't one) and this undefined nature of 'T' seems
to be what confuses the compiler. When it tries to locate SafeLt for an
undefined type 'T' it gets confused.
SafeLt is unnecessary in this context and changing it to use the '<'
operator directly avoids the problem.
The bug has been reported to Microsoft.
BUG=chromium:753488
Review-Url: https://codereview.webrtc.org/2997623002
Cr-Commit-Position: refs/heads/master@{#19292}
diff --git a/webrtc/modules/video_coding/sequence_number_util.h b/webrtc/modules/video_coding/sequence_number_util.h
index e3bc38e..008e5f1 100644
--- a/webrtc/modules/video_coding/sequence_number_util.h
+++ b/webrtc/modules/video_coding/sequence_number_util.h
@@ -84,10 +84,10 @@
// can be set. The unwrapped value is not allowed to wrap.
template <typename T, T M = 0>
class SeqNumUnwrapper {
+ // Use '<' instead of rtc::SafeLt to avoid crbug.com/753488
static_assert(
std::is_unsigned<T>::value &&
- rtc::SafeLt(std::numeric_limits<T>::max(),
- std::numeric_limits<uint64_t>::max()),
+ std::numeric_limits<T>::max() < std::numeric_limits<uint64_t>::max(),
"Type unwrapped must be an unsigned integer smaller than uint64_t.");
public: