any: Tell clang-analyzer a pointer is not nullptr (#107)
Previously, clang-analyzer warned: /.../any.h:146:5: warning: Called C++ object pointer is null [core.CallAndMessage]
This commit is contained in:
parent
5f49573daf
commit
385f9ed3ad
@ -143,6 +143,9 @@ any& any::operator=(const T& val) {
|
||||
alloc(type->size(), type->alignment());
|
||||
type->copyConstruct(value, &val);
|
||||
} else {
|
||||
#ifdef __clang_analyzer__
|
||||
assert(value != nullptr);
|
||||
#endif
|
||||
*reinterpret_cast<T*>(value) = val;
|
||||
}
|
||||
return *this;
|
||||
|
Loading…
x
Reference in New Issue
Block a user