Ref T773, gcc/clang warnings

Remark: "assuming signed overflow does not occur when assuming that (X - c) > X is always false"
This commit is contained in:
Klaus Basan
2020-02-18 21:08:56 +01:00
committed by Mat Sutcliffe
parent 4120a2c77d
commit 466c761616
3 changed files with 25 additions and 6 deletions

View File

@@ -119,12 +119,21 @@ namespace BlackMisc
//! Swap this sequence with another.
void swap(CSequence &other) noexcept { m_impl.swap(other.m_impl); }
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-overflow"
#endif
//! Access an element by its index.
reference operator [](size_type index) { Q_ASSERT(index >= 0 && index < m_impl.size()); return m_impl[index]; }
//! Access an element by its index.
const_reference operator [](size_type index) const { Q_ASSERT(index >= 0 && index < m_impl.size()); return m_impl[index]; }
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
//! Access the first element.
reference front() { Q_ASSERT(!empty()); return m_impl.front(); }