gnuradio / pmt

pmt
GNU Lesser General Public License v3.0
11 stars 11 forks source link

Compilation error: passing 'const' as 'this' argument discards qualifiers [-fpermissive] #88

Closed AsriFox closed 1 year ago

AsriFox commented 1 year ago

Trying to build gnuradio dev-4.0, I encountered an issue with this subproject.
Ninja produced 32 errors of this kind:

/usr/include/fmt/format.h:3980:38: error: passing ‘const fmt::v9::formatter< /* stuff */ >::formatter_type’ {aka ‘const fmt::v9::formatter<std::complex<double>, char, void>’} as ‘this’ argument discards qualifiers [-fpermissive]
 3980 |         out = value_formatter_.format(map(*it), ctx);
      |               ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
../include/pmtv/pmt.hpp:368:10: note:   in call to ‘auto fmt::v9::formatter<T>::format(const C&, FormatContext&) [with FormatContext = fmt::v9::basic_format_context<fmt::v9::appender, char>; C = std::complex<double>]’
  368 |     auto format(const C& arg, FormatContext& ctx) {
      |          ^~~~~~

See ninja logs.

Workaround / possible solution: modify function declarations to be const methods, like so:

When applied, this change allowed pmt to build successfuly.

AsriFox commented 1 year ago

With #89 build succeeds. Thank you for your time. Excited to see GNU Radio 4.0 in the future!