[libcxx-commits] [libcxx] [llvm] [libc++] Implement P1885R12: `<text_encoding>` (PR #141312)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jun 3 20:58:38 PDT 2026
================
@@ -0,0 +1,18 @@
+//===----------------------------------------------------------------------===//
+//
+// 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++26
+
+// consteval text_encoding text_encoding::literal() noexcept;
+
+#include <text_encoding>
+
+constexpr decltype(auto) foo() {
+ return &std::text_encoding::
+ literal; // expected-error@*:* {{cannot take address of consteval function 'literal' outside of an immediate invocation}}
----------------
frederick-vs-ja wrote:
Just a style change. Given there's `@*:*` (which expects the diagnose message to appear for an arbitrary line), we don't need to add the comment in the same line.
```suggestion
// expected-error@*:* {{cannot take address of consteval function 'literal' outside of an immediate invocation}}
return &std::text_encoding::literal;
```
https://github.com/llvm/llvm-project/pull/141312
More information about the libcxx-commits
mailing list