emio icon indicating copy to clipboard operation
emio copied to clipboard

Note Parameter passing for argument changed in GCC 7.1

Open ra-kal opened this issue 10 months ago • 2 comments

Hi,

I added custom formater and now I'm getting warnings during build. It happens with the emio main branch version.

[build] emio/include/emio/detail/args.hpp: In constructor 'emio::detail::args_span_with_str<Arg>::args_span_with_str(const emio::detail::validated_string_storage&, std::span<const Arg>) [with Arg = emio::detail::arg<emio::writer, emio::detail::format::format_arg_trait>]':
[build] emio/include/emio/detail/args.hpp:179:3: note: parameter passing for argument of type 'std::span<const emio::detail::arg<emio::writer, emio::detail::format::format_arg_trait>, 4294967295>' changed in GCC 7.1
[build]   179 |   args_span_with_str(const validated_string_storage& str, std::span<const Arg> args)
[build]       |   ^~~~~~~~~~~~~~~~~~

My formatter is simple:

#ifndef EMIO_FORMAT_H
#define EMIO_FORMAT_H

#include "Address.h"
#include <emio/format.hpp>

template<>
class emio::formatter<Address> {
public:
  static constexpr result<void> validate(reader& format_rdr)
  {
    return format_rdr.read_if_match_char('}');
  }

  constexpr result<void> parse(reader& format_rdr)
  {
    return format_rdr.read_if_match_char('}');
  }

  constexpr result<void> format(writer& out, const Address& arg) const
  {
    auto result = out.write_int(arg.address());
    if (!result)
    {
      return result;
    }
    if (arg.isAb())
    {
      result = out.write_char(arg.isA() ? 'A' : 'B');
    }
    return result;
  }
};

#endif /* EMIO_FORMAT_H */

ra-kal avatar Apr 25 '24 12:04 ra-kal