[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
Thu Jan 22 23:14:21 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:

Yes, I did but I haven't added that and just kept the original testcase provided in #176639. Just to be clear, this S = S {}` also produces the same crash. If required, I can add that as well.

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


More information about the cfe-commits mailing list