diff --git a/include/libsemigroups/detail/containers.hpp b/include/libsemigroups/detail/containers.hpp index 7cdf00acd..4c4ecf9b2 100644 --- a/include/libsemigroups/detail/containers.hpp +++ b/include/libsemigroups/detail/containers.hpp @@ -866,8 +866,18 @@ namespace libsemigroups { // Not noexcept because std::array::operator[] isn't void push_back(T x) { + // The below assertions exist to insure that we are not badly assigning + // values. The subsequent pragmas exist to suppress the false-positive + // warnings produced by g++ 13.2.0 LIBSEMIGROUPS_ASSERT(_size < N); + LIBSEMIGROUPS_ASSERT(_array.size() == N); + static_assert(std::is_same_v); +#pragma GCC diagnostic push +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif _array[_size] = x; +#pragma GCC diagnostic pop _size++; } diff --git a/include/libsemigroups/presentation.tpp b/include/libsemigroups/presentation.tpp index 5395d2a9e..c2d140f32 100644 --- a/include/libsemigroups/presentation.tpp +++ b/include/libsemigroups/presentation.tpp @@ -96,9 +96,20 @@ namespace libsemigroups { } } word_type lphbt(n, 0); + + // The below assertions exist to insure that we are not badly assigning + // values. The subsequent pragmas exist to suppress the false-positive + // warnings produced by g++ 13.2.0 + static_assert( + std::is_same_v, + decltype(words::human_readable_letter(0))>); +#pragma GCC diagnostic push +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif std::iota( lphbt.begin(), lphbt.end(), words::human_readable_letter(0)); - +#pragma GCC diagnostic pop return alphabet(lphbt); } @@ -655,9 +666,21 @@ namespace libsemigroups { } Word A(p.alphabet().size(), 0); + // The below assertion exists to insure that we are not badly assigning + // values. The subsequent pragmas exist to suppress the false-positive + // warnings produced by g++ 13.2.0 + static_assert( + std::is_same_v(0))>); + +#pragma GCC diagnostic push +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif for (size_t i = 0; i < p.alphabet().size(); ++i) { A[i] = words::human_readable_letter(i); } +#pragma GCC diagnostic pop p.alphabet(std::move(A)); #ifdef LIBSEMIGROUPS_DEBUG p.validate(); diff --git a/include/libsemigroups/to-presentation.tpp b/include/libsemigroups/to-presentation.tpp index 017fc0c0d..50037d8ae 100644 --- a/include/libsemigroups/to-presentation.tpp +++ b/include/libsemigroups/to-presentation.tpp @@ -108,7 +108,15 @@ namespace libsemigroups { presentation::normalize_alphabet(result); result.alphabet(2 * result.alphabet().size()); auto invs = result.alphabet(); + + // The below pragma exists to suppress the false-positive warnings produced + // by g++ 13.2.0 +#pragma GCC diagnostic push +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif std::rotate(invs.begin(), invs.begin() + invs.size() / 2, invs.end()); +#pragma GCC diagnostic pop result.inverses_no_checks(std::move(invs)); return result; } diff --git a/include/libsemigroups/transf.hpp b/include/libsemigroups/transf.hpp index 4e92fe0b8..9a97574b9 100644 --- a/include/libsemigroups/transf.hpp +++ b/include/libsemigroups/transf.hpp @@ -217,13 +217,23 @@ namespace libsemigroups { template explicit PTransfBase(Iterator first, Iterator last) : PTransfBase() { using OtherScalar = typename std::iterator_traits::value_type; + // The below assertions exist to insure that we are not badly assigning + // values. The subsequent pragmas exist to suppress the false-positive + // warnings produced by g++ 13.2.0 static_assert( std::is_same_v || std::is_convertible_v, "the template parameter Iterator must have " "value_type \"Undefined\" or convertible to \"point_type\"!"); + static_assert(std::is_same_v, + point_type>); resize(_container, std::distance(first, last)); +#pragma GCC diagnostic push +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic ignored "-Wstringop-overflow" +#endif std::copy(first, last, _container.begin()); +#pragma GCC diagnostic pop } //! \copydoc PTransfBase::PTransfBase(Container const&)