[clang] [Clang] Improve error recovery for invalid calls (PR #136295)

Younan Zhang via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 18 19:52:14 PDT 2025


================
@@ -34,21 +34,22 @@ void test_invalid_call_1(int s) {
 
 int some_func2(int a, int b);
 void test_invalid_call_2() {
-  // CHECK:   -RecoveryExpr {{.*}} 'int' contains-errors
+  // CHECK:   -RecoveryExpr {{.*}} '<dependent type>' contains-errors
----------------
zyn0217 wrote:

> If calling ActOnCallExpr produces a better type, we can still call it inside a SFINAETrap, in order to avoid repeated diagnostics, right?

It's a bit odd to set up a SFINAE trap at the parser side, especially since this code also applies to C.

The additional errors aren't specific to SFINAE, they also include non-SFINAE errors, and I'm not sure they're really what we want here, given that we've already diagnosed the invalid arguments.

Let's just give it an IntTy to address the dependent type concern.

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


More information about the cfe-commits mailing list