[clang] [libcxx] [Clang] Implement CWG2369 "Ordering between constraints and substitution" (PR #102857)

via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 06:30:11 PDT 2024


================
@@ -1397,12 +1415,25 @@ namespace {
                                  ArrayRef<UnexpandedParameterPack> Unexpanded,
                                  bool &ShouldExpand, bool &RetainExpansion,
                                  std::optional<unsigned> &NumExpansions) {
-      return getSema().CheckParameterPacksForExpansion(EllipsisLoc,
-                                                       PatternRange, Unexpanded,
-                                                       TemplateArgs,
-                                                       ShouldExpand,
-                                                       RetainExpansion,
-                                                       NumExpansions);
+      if (ParameterInstantiationScope) {
+        for (UnexpandedParameterPack ParmPack : Unexpanded) {
+          NamedDecl *VD = ParmPack.first.dyn_cast<NamedDecl *>();
+          if (!VD)
+            continue;
+          if (ParmVarDecl *PVD = dyn_cast<ParmVarDecl>(VD);
+              PVD &&
+              PVD->getDeclContext() ==
+                  FunctionDCForParameterDeclInstantiation &&
+              !ParameterInstantiationScope->findInstantiationUnsafe(PVD)) {
+            // Fall through to the default lookup even if we have failed to
+            // instantiate anything. We're likely to crash thereafter.
+            instantiateParameterToScope(PVD, *ParameterInstantiationScope);
----------------
cor3ntin wrote:

Crashing doesn't see appropriate. Can that ever fail? Should we add an assert?

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


More information about the cfe-commits mailing list