[all-commits] [llvm/llvm-project] 52ab95: [Clang][Sema] Revisit the fix for the lambda withi...

Younan Zhang via All-commits all-commits at lists.llvm.org
Sun Sep 1 01:11:11 PDT 2024


  Branch: refs/heads/release/19.x
  Home:   https://github.com/llvm/llvm-project
  Commit: 52ab956704050302926e8afe1c7dbda4578acb9d
      https://github.com/llvm/llvm-project/commit/52ab956704050302926e8afe1c7dbda4578acb9d
  Author: Younan Zhang <zyn7109 at gmail.com>
  Date:   2024-09-01 (Sun, 01 Sep 2024)

  Changed paths:
    M clang/lib/Sema/SemaTemplateInstantiate.cpp
    M clang/test/SemaTemplate/alias-template-with-lambdas.cpp

  Log Message:
  -----------
  [Clang][Sema] Revisit the fix for the lambda within a type alias template decl (#89934)

In the last patch #82310, we used template depths to tell if such alias
decls contain lambdas, which is wrong because the lambda can also appear
as a part of the default argument, and that would make
`getTemplateInstantiationArgs` provide extra template arguments in
undesired contexts. This leads to issue #89853.

Moreover, our approach
for https://github.com/llvm/llvm-project/issues/82104 was sadly wrong.
We tried to teach `DeduceReturnType` to consider alias template
arguments; however, giving these arguments in the context where they
should have been substituted in a `TransformCallExpr` call is never
correct.

This patch addresses such problems by using a `RecursiveASTVisitor` to
check if the lambda is contained by an alias `Decl`, as well as
twiddling the lambda dependencies - we should also build a dependent
lambda expression if the surrounding alias template arguments were
dependent.

Fixes #89853
Fixes #102760
Fixes #105885

(cherry picked from commit b412ec5d3924c7570c2c96106f95a92403a4e09b)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list