[clang] [clang] Implement CWG2815 (PR #132778)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 25 06:58:41 PDT 2025
================
@@ -47,6 +47,28 @@ void f() {
#endif
} // namespace cwg2813
+namespace cwg2815 { // cwg2815: 21
+#if __cpp_noexcept_function_type >= 201510
+int arg() noexcept;
+
+int f(int (&)() noexcept);
+void f(int (&)());
+int i = f(arg);
+
+int g(int (*)() noexcept);
+void g(int (&)());
+int j = g(arg);
+
+int h(int (&)() noexcept);
+void h(int (*)());
+int k = h(arg);
+
+int a(int (*)()); // expected-note {{candidate function}}
+int a(int (&)()); // expected-note {{candidate function}}
+int x = a(arg); // expected-error {{call to 'a' is ambiguous}}
+#endif
+} // namespace cwg2815
+
----------------
cor3ntin wrote:
can you test which overload is called (for example by making them constexpr and checking a return value with static assert)
https://github.com/llvm/llvm-project/pull/132778
More information about the cfe-commits
mailing list