[PATCH] D146178: [Clang][Sema] Fix comparison of constraint expressions
Kyrill Briantsev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri May 12 18:49:24 PDT 2023
awson added a comment.
Now, this
#include <vector>
#include <ranges>
auto drop1(const std::vector<int>& s){
return s | std::views::drop(1);
}
when compiled against gcc's-13.1 libstdc++ spits:
boro.cpp:5:11: error: invalid operands to binary expression ('const std::vector<int>' and '_Partial<_Drop, decay_t<int>>' (aka '_Partial<std::ranges::views::_Drop, int>'))
return s | std::views::drop(1);
~ ^ ~~~~~~~~~~~~~~~~~~~
C:\Progs\msys64\ucrt64\include\c++\13.1.0\cstddef:135:3: note: candidate function not viable: no known conversion from 'const std::vector<int>' to 'byte' for 1st argument
operator|(byte __l, byte __r) noexcept
^
C:\Progs\msys64\ucrt64\include\c++\13.1.0\bits/ios_base.h:87:3: note: candidate function not viable: no known conversion from 'const std::vector<int>' to '_Ios_Fmtflags' for 1st argument
operator|(_Ios_Fmtflags __a, _Ios_Fmtflags __b)
^
C:\Progs\msys64\ucrt64\include\c++\13.1.0\bits/ios_base.h:130:3: note: candidate function not viable: no known conversion from 'const std::vector<int>' to '_Ios_Openmode' for 1st argument
operator|(_Ios_Openmode __a, _Ios_Openmode __b)
^
C:\Progs\msys64\ucrt64\include\c++\13.1.0\bits/ios_base.h:170:3: note: candidate function not viable: no known conversion from 'const std::vector<int>' to '_Ios_Iostate' for 1st argument
operator|(_Ios_Iostate __a, _Ios_Iostate __b)
^
C:\Progs\msys64\ucrt64\include\c++\13.1.0\ranges:887:7: note: candidate template ignored: constraints not satisfied [with _Self = _Partial<_Drop, decay_t<int>>, _Range = const std::vector<int> &]
operator|(_Range&& __r, _Self&& __self)
^
C:\Progs\msys64\ucrt64\include\c++\13.1.0\ranges:885:5: note: because '__adaptor_invocable<std::ranges::views::__adaptor::_Partial<std::ranges::views::_Drop, int>, const std::vector<int> &>' evaluated to false
&& __adaptor_invocable<_Self, _Range>
^
C:\Progs\msys64\ucrt64\include\c++\13.1.0\ranges:860:20: note: because 'std::declval<_Adaptor>()(declval<_Args>()...)' would be invalid: no matching function for call to object of type 'std::ranges::views::__adaptor::_Partial<std::ranges::views::_Drop, int>'
= requires { std::declval<_Adaptor>()(declval<_Args>()...); };
^
C:\Progs\msys64\ucrt64\include\c++\13.1.0\ranges:896:7: note: candidate template ignored: constraints not satisfied [with _Lhs = std::vector<int>, _Rhs = _Partial<_Drop, decay_t<int>>]
operator|(_Lhs __lhs, _Rhs __rhs)
^
C:\Progs\msys64\ucrt64\include\c++\13.1.0\ranges:893:16: note: because 'derived_from<std::vector<int>, _RangeAdaptorClosure>' evaluated to false
requires derived_from<_Lhs, _RangeAdaptorClosure>
^
C:\Progs\msys64\ucrt64\include\c++\13.1.0\concepts:67:28: note: because '__is_base_of(std::ranges::views::__adaptor::_RangeAdaptorClosure, std::vector<int>)' evaluated to false
concept derived_from = __is_base_of(_Base, _Derived)
^
1 error generated.
`transform` doesn't work either.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D146178/new/
https://reviews.llvm.org/D146178
More information about the cfe-commits
mailing list