[Bug c++/111539] New: __is_range_adaptor_closure_fn is too loosely defined
hewillk at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Sep 22 14:46:20 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111539
Bug ID: 111539
Summary: __is_range_adaptor_closure_fn is too loosely defined
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: hewillk at gmail dot com
Target Milestone: ---
template<typename _Tp, typename _Up>
requires (!same_as<_Tp, _RangeAdaptorClosure<_Up>>)
void __is_range_adaptor_closure_fn
(const _Tp&, const _RangeAdaptorClosure<_Up>&); // not defined
template<typename _Tp>
concept __is_range_adaptor_closure
= requires (_Tp __t) { __adaptor::__is_range_adaptor_closure_fn(__t,
__t); };
The standard requires range adapter closure object type T to model
derived_from<range_adaptor_closure<T>>. However, the above definition does not
consider whether the template parameter of range_adaptor_closure is T, which
makes libstdc++ accept the following
#include <ranges>
struct _;
struct closure : std::ranges::range_adaptor_closure<_> {
int operator()(auto&&);
};
int main() {
auto r = std::views::iota(0) | closure{};
}
More information about the Gcc-bugs
mailing list