Skip to content

Conversation

zyn0217
Copy link
Contributor

@zyn0217 zyn0217 commented Oct 4, 2025

This addresses the post-commit review from Shafik.

This addresses the post-commit review from Shafik.
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Oct 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 4, 2025

@llvm/pr-subscribers-clang

Author: Younan Zhang (zyn0217)

Changes

This addresses the post-commit review from Shafik.


Full diff: https://github.com/llvm/llvm-project/pull/161948.diff

1 Files Affected:

  • (modified) clang/lib/Sema/SemaTemplateDeductionGuide.cpp (+6-13)
diff --git a/clang/lib/Sema/SemaTemplateDeductionGuide.cpp b/clang/lib/Sema/SemaTemplateDeductionGuide.cpp
index 9a61888e318b3..8ba23aa334afd 100644
--- a/clang/lib/Sema/SemaTemplateDeductionGuide.cpp
+++ b/clang/lib/Sema/SemaTemplateDeductionGuide.cpp
@@ -1189,14 +1189,13 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef,
     // parameter list of a synthesized CTAD guide. See also the FIXME in
     // test/SemaCXX/cxx20-ctad-type-alias.cpp:test25.
     Sema::CheckTemplateArgumentInfo CTAI;
+    for (auto TA : Output.arguments())
+      if (SemaRef.CheckTemplateArgument(
+              TP, TA, F, F->getLocation(), F->getLocation(),
+              /*ArgumentPackIndex=*/-1, CTAI,
+              Sema::CheckTemplateArgumentKind::CTAK_Specified))
+        return nullptr;
     if (Input.getArgument().getKind() == TemplateArgument::Pack) {
-      for (auto TA : Output.arguments()) {
-        if (SemaRef.CheckTemplateArgument(
-                TP, TA, F, F->getLocation(), F->getLocation(),
-                /*ArgumentPackIndex=*/-1, CTAI,
-                Sema::CheckTemplateArgumentKind::CTAK_Specified))
-          return nullptr;
-      }
       // We will substitute the non-deduced template arguments with these
       // transformed (unpacked at this point) arguments, where that substitution
       // requires a pack for the corresponding parameter packs.
@@ -1204,12 +1203,6 @@ BuildDeductionGuideForTypeAlias(Sema &SemaRef,
           TemplateArgument::CreatePackCopy(Context, CTAI.SugaredConverted);
     } else {
       assert(Output.arguments().size() == 1);
-      TemplateArgumentLoc Transformed = Output.arguments()[0];
-      if (SemaRef.CheckTemplateArgument(
-              TP, Transformed, F, F->getLocation(), F->getLocation(),
-              /*ArgumentPackIndex=*/-1, CTAI,
-              Sema::CheckTemplateArgumentKind::CTAK_Specified))
-        return nullptr;
       TemplateArgsForBuildingFPrime[Index] = CTAI.SugaredConverted[0];
     }
   }

@zyn0217 zyn0217 merged commit 7fbfbab into llvm:main Oct 4, 2025
11 of 12 checks passed
@zyn0217 zyn0217 deleted the post-161035 branch October 4, 2025 06:14
Copy link
Collaborator

@shafik shafik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants