[libcxx-commits] [libcxx] [libcxx] Add LWG4135: The helper lambda of std::erase for list should specify return type as bool (PR #128358)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Feb 25 10:09:52 PST 2025
================
@@ -0,0 +1,38 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+
+// <forward_list>
+
+// This test shows the effect of implementing `LWG4135`, before it this code
+// shouldn't compile with a long error message, as the predicate is not bool.
+// `LWG4135` suggests that std::erase explicitly specifying the lambda's
+// return type as bool.
----------------
mordante wrote:
```suggestion
// This test shows the effect of implementing `LWG4135`, before it this code
// was ill-formed, as the predicate is not bool.
// `LWG4135` suggests that std::erase explicitly specifying the lambda's
// return type as bool.
```
A minor change to describe the issue in language of the Standard.
Especially the `a long error message` depends on the compiler used.
https://github.com/llvm/llvm-project/pull/128358
More information about the libcxx-commits
mailing list