Recent Clang versions fixed a bug which had previously allowed some casts that
removed qualifiers to go undiagnosed.
This fixes the following kind of error:
./../third_party/webrtc/api/optional.h:41:35: error: reinterpret_cast from
'const int *' to 'void *' casts away qualifiers
FunctionThatDoesNothingImpl(reinterpret_cast<void*>(x)));
^~~~~~~~~~~~~~~~~~~~~~~~~~
../../third_party/webrtc/api/optional.h:280:45: note: in instantiation of
function template specialization
'rtc::optional_internal::FunctionThatDoesNothing<const int>' requested here
return has_value_ ? *optional_internal::FunctionThatDoesNothing(&value_)
^
../../third_party/webrtc/call/rtp_bitrate_configurator.cc:70:53:
note: in instantiation of member function 'rtc::Optional<int>::value_or'
requested here
std::max(bitrate_config_mask_.min_bitrate_bps.value_or(0),
^
Bug: chromium:831081
Change-Id: I032ebd1f052fa2a50548e984febb7fa462df42ea
Reviewed-on: https://webrtc-review.googlesource.com/68941
Commit-Queue: Hans Wennborg <hans@chromium.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#22804}
35 lines
784 B
C++
35 lines
784 B
C++
/*
|
|
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license
|
|
* that can be found in the LICENSE file in the root of the source
|
|
* tree. An additional intellectual property rights grant can be found
|
|
* in the file PATENTS. All contributing project authors may
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#include "api/optional.h"
|
|
|
|
namespace rtc {
|
|
namespace optional_internal {
|
|
|
|
#if RTC_HAS_ASAN
|
|
|
|
const void* FunctionThatDoesNothingImpl(const void* x) {
|
|
return x;
|
|
}
|
|
|
|
#endif
|
|
|
|
struct NulloptArg {
|
|
constexpr NulloptArg() {}
|
|
};
|
|
|
|
static NulloptArg nullopt_arg;
|
|
|
|
} // namespace optional_internal
|
|
|
|
const nullopt_t nullopt(rtc::optional_internal::nullopt_arg);
|
|
|
|
} // namespace rtc
|