https://bugs.llvm.org/show_bug.cgi?id=50717
Bug ID: 50717
Summary: std::ranges::size incorrectly uses perfect forwarding
Product: libc++
Version: 12.0
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P
Component: All Bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
test/std/ranges/range.access/range.prim/size.pass.cpp has this check:
assert(std::ranges::size(MoveOnlySizeFunction()) == 42);
which relies on this function being called with an rvalue:
friend constexpr size_t size(MoveOnlySizeFunction) { return 42; }
However, the relevant part of the standard says an lvalue should be used:
"then ranges::size(E) is expression-equivalent to decay-copy(size(t))"
where 't' is an lvalue, i.e. it should not be forwarded.
As a result, the test fails for libstdc++ trunk (since I fixed the same bug
earlier this month).
The spec was changed by https://wg21.link/p2091r0 to use lvalues everywhere
except ranges::cdata.
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs