https://bugs.kde.org/show_bug.cgi?id=379537

--- Comment #3 from Marc Mutz <[email protected]> ---
You can make this work by replacing the VALGRIND_DO_CLIENT_REQUEST_EXPR macro
with a __attribute__((always_inline)) / __force_inline function. Then constexpr
functions can use the macro in a ternary, because you can call non-constexpr
functions in one term of the ternary (but not both).

    template <typename Char, if_compatible_char<Char> = true>
    Q_DECL_CONSTEXPR QStringView(const Char *str, qssize_t len)
        : m_size((Q_ASSERT(len >= 0),
                  static_cast<void>(str ? VALGRIND_CHECK_MEM_IS_DEFINED(str,
len) : 0),
                  Q_ASSERT(str || !len), len)),
          m_data(castHelper(str)) {}

The function won't effectively be constexpr unless NVALGRIND is defined, but at
least you don't need to #ifndef the constexpr on the function on NVALGRIND.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to