Suppress null-dereference warning

It is unclear whether author intentionally meant to cause segfault here.
While waiting for the author to explain/fix the code, suppress the
warning to unblock enabling the warning globally.

Test: m checkbuild
Bug: 121390225
Change-Id: Iad03842833cfdc243404a32f6b31d161387c3890
This commit is contained in:
Yi Kong 2018-12-21 14:52:47 -08:00
parent b31202ca17
commit 45cb85f8c0
2 changed files with 6 additions and 0 deletions

View file

@ -274,7 +274,10 @@ inline KeyParameter Authorization(TypedTag<tag_type, tag> ttag, Args&&... args)
*/
template <typename ValueT> class NullOr {
template <typename T> struct reference_initializer {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnull-dereference"
static T&& init() { return *static_cast<std::remove_reference_t<T>*>(nullptr); }
#pragma GCC diagnostic pop
};
template <typename T> struct pointer_initializer {
static T init() { return nullptr; }

View file

@ -282,7 +282,10 @@ template <typename ValueT>
class NullOr {
template <typename T>
struct reference_initializer {
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnull-dereference"
static T&& init() { return *static_cast<std::remove_reference_t<T>*>(nullptr); }
#pragma GCC diagnostic pop
};
template <typename T>
struct pointer_initializer {