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

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 08:02:59 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();
----------------
Endilll wrote:

I applied your suggestion, leaving error recovery issue for later, and also added tests for pointer and reference types. Thank you again for your excellent analysis.

If that's how it should be fixed today, I'm fine proceeding this way. That said, I find the approach somewhat backwards: morally I'm interested whether there's a constrained auto that might be using a concept, but we implement it asking for _location_ of constrained auto, and get the AST node for constrained auto from it.

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


More information about the cfe-commits mailing list