[clang] [Clang] Fix handling of overloads differing only by constraints and ref-qualifiers (PR #192018)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Thu Apr 16 02:57:03 PDT 2026


================
@@ -212,5 +212,16 @@ struct T : S {
     virtual void k() &;
     virtual void l() &&;
 };
+#if __cplusplus >= 202002L
+
+// We should not error on inconsistent ref-qualifiers if the functions
+// have different constraints.
+template <unsigned R> struct type {
+    void func() const requires(R == 0);
+    void func() & requires(R == 1);
----------------
Endilll wrote:

No overriding of virtual functions is happening here. Why is this case in CWG2496 test?

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


More information about the cfe-commits mailing list