[libcxx-commits] [libcxx] [libc++] P2770R0: "Stashing stashing iterators for proper flattening" (PR #66033)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Thu Nov 16 18:15:55 PST 2023
================
@@ -0,0 +1,48 @@
+//===----------------------------------------------------------------------===//
----------------
ldionne wrote:
You need to split this test into two tests. Right now, this code is only compiled, but never run (because `.verify.cpp` doesn't run stuff, it only compiles). So:
```c++
//
// as-lvalue.lifetimebound.verify.cpp
//
void f() {
[[maybe_unused]] auto& check = std::ranges::__as_lvalue(0); // expected-warning {{temporary bound to local reference 'check' will be destroyed at the end of the full-expression}}
}
//
// as-lvalue.pass.cpp
//
constexpr bool test() {
// Check glvalue
{
int lvalue{};
[[maybe_unused]] std::same_as<int&> decltype(auto) check = std::ranges::__as_lvalue(lvalue);
}
// Check xvalue
{
int xvalue{};
[[maybe_unused]] std::same_as<int&> decltype(auto) check = std::ranges::__as_lvalue(std::move(xvalue));
}
return true;
}
int main(int, char**) {
test();
static_assert(test());
return 0;
}
```
https://github.com/llvm/llvm-project/pull/66033
More information about the libcxx-commits
mailing list