diff --git a/include/wx/string.h b/include/wx/string.h index eb54eb24c7..ab0a72b737 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -569,6 +569,12 @@ private: // its corresponding index in the byte string or not Cache::Element *GetCacheElement() const { + // gcc warns about cacheBegin and c inside the loop being possibly null, + // but this shouldn't actually be the case +#if wxCHECK_GCC_VERSION(6,1) + wxGCC_ONLY_WARNING_SUPPRESS(null-dereference) +#endif + Cache::Element * const cacheBegin = GetCacheBegin(); Cache::Element * const cacheEnd = GetCacheEnd(); Cache::Element * const cacheStart = cacheBegin + LastUsedCacheElement(); @@ -598,6 +604,10 @@ private: } return c; + +#if wxCHECK_GCC_VERSION(6,1) + wxGCC_ONLY_WARNING_RESTORE(null-dereference) +#endif } size_t DoPosToImpl(size_t pos) const