[clang] [clang] Fix crash in concept deprecation (PR #98622)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 15 11:22:41 PDT 2024


================
@@ -7416,10 +7416,11 @@ NamedDecl *Sema::ActOnVariableDeclarator(
     tryToFixVariablyModifiedVarType(TInfo, R, D.getIdentifierLoc(),
                                     /*DiagID=*/0);
 
-  if (const AutoType *AutoT = R->getAs<AutoType>())
-    CheckConstrainedAuto(
-        AutoT,
-        TInfo->getTypeLoc().getContainedAutoTypeLoc().getConceptNameLoc());
+  if (const AutoType *AutoT = R->getAs<AutoType>()) {
+    AutoTypeLoc Loc = TInfo->getTypeLoc().getContainedAutoTypeLoc();
----------------
mizvekov wrote:

Regarding the error recovery issue, in `SemaOverload.cpp`:

In `FixOverloadedFunctionReference`, for both `UnresolvedLookupExpr` and `UnresolvedMemberExpr`, we must avoid building a `DeclRefExpr` which has a function type returning undeduced auto.

Presently this should only happen for calls to deleted functions returning a deduced type, so should only happen when it's called from `FinishOverloadedCallExpr`, in the `OR_Deleted` case.

You can replace just the `auto` in the return type with `int`, keeping pointers and references in case of `auto *` or `auto &`. That can be done using `Sema::SubstAutoType`.

Eventually when we implement some kind of `ErrorTy`, for improving error recovery, we can change all such uses of 'int', using that instead.

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


More information about the cfe-commits mailing list