[clang] [clang] Fix a crash when default argument is passed to an explicit object parameter (PR #177534)

via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 23 02:42:51 PST 2026


================
@@ -1400,3 +1400,18 @@ a void Bar(this int) { // expected-note {{candidate function}}
 }
 
 }
+
+namespace GH176639 {
+
+struct S {
+  void operator()(this S =) // expected-error {{the explicit object parameter cannot have a default argument}}
+          // expected-error at -1 {{expected ';' at end of declaration list}}
+          // expected-error at -2 {{expected expression}}
+};
----------------
hax0kartik wrote:

You need to call the () operator somewhere to make it crash. https://godbolt.org/z/764ao4E1x

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


More information about the cfe-commits mailing list