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

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 11:41:38 PDT 2024


================
@@ -6308,11 +6308,11 @@ TypeResult Sema::ActOnTypeName(Declarator &D) {
     CheckExtraCXXDefaultArguments(D);
   }
 
-  if (const AutoType *AutoT = T->getAs<AutoType>())
-    CheckConstrainedAuto(
-        AutoT,
-        TInfo->getTypeLoc().getContainedAutoTypeLoc().getConceptNameLoc());
-
+  if (const AutoType *AutoT = T->getAs<AutoType>()) {
+    AutoTypeLoc Loc = TInfo->getTypeLoc().getContainedAutoTypeLoc();
+    CheckConstrainedAuto(AutoT,
+                         Loc ? Loc.getConceptNameLoc() : SourceLocation());
+  }
----------------
mizvekov wrote:

Ah, is this purely for the error cases?

Ie in my example above, you will still get the error, but is that for suppressing the deprecated warning in case that auto was constrained and happened to be the only use of that concept?

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


More information about the cfe-commits mailing list