[clang] [clang] Fix assertion failure with deleted overloaded unary operators (PR #78316)

via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 16 09:53:48 PST 2024


================
@@ -598,3 +598,30 @@ namespace B {
 }
 void g(B::X x) { A::f(x); }
 }
+
+namespace GH78314 {
+
+class a {
+public:
+  void operator--() = delete; // expected-note {{candidate function has been explicitly deleted}} \
+                              // expected-note {{candidate function not viable: requires 0 arguments, but 1 was provided}}
+  void operator--(int) = delete; // expected-note {{candidate function has been explicitly deleted}} \
+                                 // expected-note {{candidate function not viable: requires 1 argument, but 0 were provided}}
+};
----------------
cor3ntin wrote:

can you add tests for (in another class)

```cpp
void operator--(this a) = delete;
void operator--(this a, int) = delete
``` 
?

Thanks!

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


More information about the cfe-commits mailing list