[4.1.0] build failures "no match for 'operator='" and similar with gcc-14
Opened this issue · 0 comments
olebole commented
I am just trying to build sopt 4.1.0 from source to update the Debian package (from 3.1.0). The compilation fails with errors like
In file included from /build/sopt-4.1.0+dfsg/cpp/sopt/../sopt/imaging_padmm.h:15,
from /build/sopt-4.1.0+dfsg/cpp/tests/reweighted.cc:6:
/build/sopt-4.1.0+dfsg/cpp/sopt/../sopt/relative_variation.h: In member function 'const sopt::RelativeVariation<TYPE>& sopt::RelativeVariation<TYPE>::name(const std::string&) const':
/build/sopt-4.1.0+dfsg/cpp/sopt/../sopt/relative_variation.h:44:13: error: no match for 'operator=' (operand types are 'const std::string' {aka 'const std::__cxx11::basic_string<char>'} and 'const std::string' {aka 'const std::__cxx11::basic_string<char>'})
44 | name_ = name;
| ^~~~
In file included from /usr/include/c++/14/string:54,
from /usr/include/catch2/interfaces/catch_interfaces_capture.hpp:11,
from /usr/include/catch2/benchmark/catch_benchmark.hpp:19,
from /usr/include/catch2/benchmark/catch_benchmark_all.hpp:24,
from /usr/include/catch2/catch_all.hpp:25,
from /build/sopt-4.1.0+dfsg/cpp/tests/reweighted.cc:1:
/usr/include/c++/14/bits/basic_string.h:817:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (near match)
817 | operator=(const basic_string& __str)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:817:7: note: passing 'const std::string*' {aka 'const std::__cxx11::basic_string<char>*'} as 'this' argument discards qualifiers
/usr/include/c++/14/bits/basic_string.h:858:7: note: candidate: 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc>& std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]' (near match)
858 | operator=(basic_string&& __str)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:858:7: note: conversion of argument 1 would be ill-formed:
/usr/include/c++/14/bits/basic_string.h:941:8: note: candidate: 'template<class _Tp> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv<_Tp, std::__cxx11::basic_string<_CharT, _Traits, _Alloc>&> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::operator=(const _Tp&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
941 | operator=(const _Tp& __svt)
| ^~~~~~~~
/usr/include/c++/14/bits/basic_string.h:941:8: note: template argument deduction/substitution failed:
In file included from /usr/include/catch2/internal/catch_move_and_forward.hpp:11,
from /usr/include/catch2/benchmark/catch_benchmark.hpp:16:
/usr/include/c++/14/type_traits: In substitution of 'template<bool _Cond, class _Tp> using std::enable_if_t = typename std::enable_if::type [with bool _Cond = false; _Tp = std::__cxx11::basic_string<char>&]':
/usr/include/c++/14/bits/basic_string.h:149:8: required by substitution of 'template<class _CharT, class _Traits, class _Alloc> template<class _Tp, class _Res> using std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::_If_sv = std::enable_if_t<((bool)std::__and_<std::is_convertible<const _Tp&, std::basic_string_view<_CharT, _Traits> >, std::__not_<std::is_convertible<const _Tp*, const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>*> >, std::__not_<std::is_convertible<const _Tp&, const _CharT*> > >::value), _Res> [with _Tp = std::__cxx11::basic_string<char>; _Res = std::__cxx11::basic_string<char>&; _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]'
149 | using _If_sv = enable_if_t<
| ^~~~~~
/usr/include/c++/14/bits/basic_string.h:941:8: required by substitution of 'template<class _Tp> std::__cxx11::basic_string<char>::_If_sv<_Tp, std::__cxx11::basic_string<char>&> std::__cxx11::basic_string<char>::operator=(const _Tp&) [with _Tp = std::__cxx11::basic_string<char>]'
941 | operator=(const _Tp& __svt)
| ^~~~~~~~
/build/sopt-4.1.0+dfsg/cpp/sopt/../sopt/relative_variation.h:44:13: required from here
44 | name_ = name;
| ^~~~
Full build log is attached: sopt_4.1.0+dfsg-1_amd64.build.txt
The same problem was already reported for version 3.1.0 as Debian#1075526, with this build log.
As I am rather unexperienced with C++, I have no idea what that means. Can you help fixing this?