[clang] [Clang][AST] Add Test Cases for Reference Qualifiers in Opr Overload (PR #102878)

via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 12 03:46:55 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Muhammad Abdul  (0xzre)

<details>
<summary>Changes</summary>

Follow up of issue #<!-- -->102422 


---
Full diff: https://github.com/llvm/llvm-project/pull/102878.diff


1 Files Affected:

- (modified) clang/test/SemaCXX/function-type-qual.cpp (+14) 


``````````diff
diff --git a/clang/test/SemaCXX/function-type-qual.cpp b/clang/test/SemaCXX/function-type-qual.cpp
index f4906f58abbae0..a46b774dc57e69 100644
--- a/clang/test/SemaCXX/function-type-qual.cpp
+++ b/clang/test/SemaCXX/function-type-qual.cpp
@@ -54,4 +54,18 @@ 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 C {
+  void* operator new(size_t bytes) &;  //expected-error {{static member function cannot have '&' qualifier}}
+  void* operator new[](size_t bytes) &;  //expected-error {{static member function cannot have '&' qualifier}}
+
+  void* operator new(size_t bytes) &&;  //expected-error {{static member function cannot have '&&' qualifier}}
+  void* operator new[](size_t bytes) &&;  //expected-error {{static member function cannot have '&&' qualifier}}
+
+  void operator delete(void*) &;  //expected-error {{static member function cannot have '&' qualifier}}
+  void operator delete[](void*) &;  //expected-error {{static member function cannot have '&' qualifier}}
+
+  void operator delete(void*) &&;  //expected-error {{static member function cannot have '&&' qualifier}}
+  void operator delete[](void*) &&;  //expected-error {{static member function cannot have '&&' qualifier}}
+};
 }

``````````

</details>


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


More information about the cfe-commits mailing list