[clang] [Clang] Add tests for ref-qualified operator new (PR #215644)

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 02:11:53 PDT 2026


================
@@ -54,4 +54,11 @@ struct B {
   void operator delete(void*) volatile; //expected-error {{static member function cannot have 'volatile' qualifier}}
   void operator delete[](void*) volatile; //expected-error {{static member function cannot have 'volatile' qualifier}}
 };
-}
+  struct RefQualifierLValue {
+    void* operator new(size_t bytes) &; // expected-error {{static member function cannot have '&' qualifier}}
+  };
+
+  struct RefQualifierRValue {
+    void* operator new(size_t bytes) &&; // expected-error {{static member function cannot have '&&' qualifier}}
+  };
+  } // namespace GH79748
----------------
Fznamznon wrote:

Could you please add a newline at the end of file?

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


More information about the cfe-commits mailing list