[libcxx-commits] [libcxx] [libc++][ranges] LWG4096: `views::iota(views::iota(0))` should be rejected (PR #152855)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Sat Aug 9 12:18:59 PDT 2025


================
@@ -0,0 +1,29 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// REQUIRES: std-at-least-c++20
+
+// views::iota
+
+#include <ranges>
+
+#include "types.h"
+
+void test() {
+  // LWG4096
+  {
+    [[maybe_unused]] auto i1 = std::views::iota(0); // OK
+    [[maybe_unused]] auto i2 = std::views::iota(std::views::iota(0));
+    // expected-error@*:* {{no matching function for call to object of type 'const __iota::__fn'}}
----------------
philnik777 wrote:

We shouldn't add verify tests if we can check through SFINAE.

https://github.com/llvm/llvm-project/pull/152855


More information about the libcxx-commits mailing list