range-v3
range-v3 copied to clipboard
Qt6 and range-v3 error build telegram desktop with clang 13-14
In file included from <built-in>:484:
In file included from /build/telegram-desktop+clang/src/build/Telegram/CMakeFiles/Telegram.dir/cmake_pch.hxx:5:
In file included from /build/telegram-desktop+clang/src/tdesktop-3.6.0-full/Telegram/SourceFiles/stdafx.h:102:
In file included from /usr/include/range/v3/all.hpp:17:
In file included from /usr/include/range/v3/action.hpp:32:
In file included from /usr/include/range/v3/action/split.hpp:28:
/usr/include/range/v3/range/conversion.hpp:379:29: error: alias template 'QVector' requires template arguments; argument deduction only allowed for class templates
-> decltype(ContT(range_cpp17_iterator_t<Rng>{},
^
/usr/include/meta/meta.hpp:541:5: note: in instantiation of template class 'ranges::detail::from_range<QVector>' requested here
using invoke = typename Fn::template invoke<Args...>;
^
/usr/include/range/v3/range/conversion.hpp:46:13: note: in instantiation of template type alias 'invoke' requested here
using container_t = meta::invoke<MetaFn, Rng>;
^
/usr/include/range/v3/range/conversion.hpp:338:46: note: in instantiation of template type alias 'container_t' requested here
convertible_to_cont<Rng, container_t<MetaFn, Rng>>)
^
/usr/include/range/v3/detail/prologue.hpp:35:26: note: expanded from macro 'template'
template<__VA_ARGS__ CPP_TEMPLATE_AUX_ \
^
/usr/include/range/v3/range/conversion.hpp:304:13: note: in instantiation of template class 'ranges::detail::to_container::fn<ranges::detail::from_range<QVector>>' requested here
, Fn
^
/usr/include/range/v3/range/conversion.hpp:425:20: note: in instantiation of template class 'ranges::detail::to_container::closure<ranges::detail::from_range<QVector>, ranges::detail::to_container::fn<ranges::detail::from_range<QVector>>>' requested here
return detail::to_container_fn<detail::from_range<ContT>>{}(
^
/build/telegram-desktop+clang/src/tdesktop-3.6.0-full/Telegram/SourceFiles/api/api_media.cpp:86:12: note: in instantiation of function template specialization 'ranges::_to_::to<QVector, std::vector<tl::boxed<MTPinputDocument>> &>' requested here
ranges::to<QVector>(info.attachedStickers)),
^
/usr/include/qt6/QtCore/qcontainerfwd.h:63:22: note: template is declared here
template<typename T> using QVector = QList<T>;
^
In file included from <built-in>:484:
In file included from /build/telegram-desktop+clang/src/build/Telegram/CMakeFiles/Telegram.dir/cmake_pch.hxx:5:
In file included from /build/telegram-desktop+clang/src/tdesktop-3.6.0-full/Telegram/SourceFiles/stdafx.h:102:
In file included from /usr/include/range/v3/all.hpp:17:
In file included from /usr/include/range/v3/action.hpp:32:
In file included from /usr/include/range/v3/action/split.hpp:28:
/usr/include/range/v3/range/conversion.hpp:425:20: error: type 'detail::to_container_fn<detail::from_range<QVector>>' (aka 'closure<ranges::detail::from_range<QVector>, ranges::detail::to_container::fn<ranges::detail::from_range<QVector>>>') does not provide a call operator
return detail::to_container_fn<detail::from_range<ContT>>{}(
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/build/telegram-desktop+clang/src/tdesktop-3.6.0-full/Telegram/SourceFiles/api/api_media.cpp:86:12: note: in instantiation of function template specialization 'ranges::_to_::to<QVector, std::vector<tl::boxed<MTPinputDocument>> &>' requested here
ranges::to<QVector>(info.attachedStickers)),
^
2 errors generated.
That's a language limitation due to a feature Clang has yet to implement. This can't be fixed on Range-v3's side, so you'd have to report to whomever is calling ranges::to<QVector>
.
@JohelEGP affects llvm 14 too. So it's not a compiler problem, your library probably violates some of the standards. Because clang gives the best search for errors in the code.
Clang hasn't implemented the feature yet, so it doesn't matter whether it's Clang 14 or 15, except that there's a possibility it's implemented for Clang 15 before its feature freeze.
The feature is "Class template argument deduction for alias templates" at https://en.cppreference.com/w/cpp/compiler_support.