Skip to content

Conversation

mizvekov
Copy link
Contributor

The AutoType's deduced-as-dependent mechanism is not really used for constant template parameters, but this is currently harmless to ignore because when dealing which such types, they will have been transformed, turning them back to plain undeduced AutoTypes.

This should be NFC for current main users, but #141776 will depend on this.

… parameters

The AutoType's deduced-as-dependent mechanism is not really used for constant
template parameters, but this is currently harmless to ignore because when
dealing which such types, they will have been transformed, turning them back to
plain undeduced AutoTypes.

This should be NFC for current main users, but #141776
will depend on this.
@mizvekov mizvekov self-assigned this Sep 28, 2025
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Sep 28, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 28, 2025

@llvm/pr-subscribers-clang

Author: Matheus Izvekov (mizvekov)

Changes

The AutoType's deduced-as-dependent mechanism is not really used for constant template parameters, but this is currently harmless to ignore because when dealing which such types, they will have been transformed, turning them back to plain undeduced AutoTypes.

This should be NFC for current main users, but #141776 will depend on this.


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

1 Files Affected:

  • (modified) clang/lib/Sema/SemaTemplate.cpp (+1-1)
diff --git a/clang/lib/Sema/SemaTemplate.cpp b/clang/lib/Sema/SemaTemplate.cpp
index 3ebbb30ae483e..2bf1511c5cfa0 100644
--- a/clang/lib/Sema/SemaTemplate.cpp
+++ b/clang/lib/Sema/SemaTemplate.cpp
@@ -7102,7 +7102,7 @@ ExprResult Sema::CheckTemplateArgument(NamedDecl *Param, QualType ParamType,
 
   // If the parameter type somehow involves auto, deduce the type now.
   DeducedType *DeducedT = ParamType->getContainedDeducedType();
-  bool IsDeduced = DeducedT && !DeducedT->isDeduced();
+  bool IsDeduced = DeducedT && DeducedT->getDeducedType().isNull();
   if (IsDeduced) {
     // When checking a deduced template argument, deduce from its type even if
     // the type is dependent, in order to check the types of non-type template

@mizvekov mizvekov changed the title [clang] treat deduced-as-dependent as undeduced for cosntant template parameters [clang] treat deduced-as-dependent as undeduced for constant template parameters Sep 28, 2025
Copy link
Contributor

@cor3ntin cor3ntin left a comment

Choose a reason for hiding this comment

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

Impressingly/confusingly, this does solve our issues. Thanks for the quick fix

@mizvekov mizvekov merged commit 85d48b8 into main Sep 29, 2025
12 checks passed
@mizvekov mizvekov deleted the users/mizvekov/check-nttp-ignore-deduced-as-dependent branch September 29, 2025 06:46
mahesh-attarde pushed a commit to mahesh-attarde/llvm-project that referenced this pull request Oct 3, 2025
… parameters (llvm#161099)

The AutoType's deduced-as-dependent mechanism is not really used for
constant template parameters, but this is currently harmless to ignore
because when dealing which such types, they will have been transformed,
turning them back to plain undeduced AutoTypes.

This should be NFC for current main users, but
llvm#141776 will depend on this.
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