[clang] [clang] Implement CWG2815 (PR #132778)
Vlad Serebrennikov via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 9 15:17:40 PDT 2025
================
@@ -47,6 +47,31 @@ void f() {
#endif
} // namespace cwg2813
+namespace cwg2815 { // cwg2815: 21
+#if __cplusplus >= 201703L
+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 (*)());
+int a(int (&)());
+int x = a(arg);
+// expected-error at -1 {{call to 'a' is ambiguous}}
+// expected-note at -4 {{candidate function}}
----------------
Endilll wrote:
```suggestion
// expected-note@#cwg2815-a-ptr {{candidate function}}
```
As you've experienced yourself, maintaining relative line offsets is annoying. Counting lines outside of very trivial cases it annoying for reviewers, too.
https://github.com/llvm/llvm-project/pull/132778
More information about the cfe-commits
mailing list