[all-commits] [llvm/llvm-project] a413c5: [Clang][Sema] Fix a bug on template partial specia...

Qizhi Hu via All-commits all-commits at lists.llvm.org
Tue Apr 30 01:15:28 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a413c563bdcaac08f7c325c7d69e19f924435e59
      https://github.com/llvm/llvm-project/commit/a413c563bdcaac08f7c325c7d69e19f924435e59
  Author: Qizhi Hu <836744285 at qq.com>
  Date:   2024-04-30 (Tue, 30 Apr 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/include/clang/Sema/Sema.h
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/lib/Sema/SemaTemplateDeduction.cpp
    A clang/test/SemaCXX/PR68885.cpp

  Log Message:
  -----------
  [Clang][Sema] Fix a bug on template partial specialization with issue on deduction of nontype template parameter (#90376)

Fix https://github.com/llvm/llvm-project/issues/68885
When build expression from a deduced argument whose kind is
`Declaration` and `NTTPType`(which declared as `decltype(auto)`) is
deduced as a reference type, `BuildExpressionFromDeclTemplateArgument`
just create a `DeclRef`. This is incorrect while we get type from the
expression since we can't get the original reference type from
`DeclRef`. Creating a `SubstNonTypeTemplateParmExpr` expression and make
the deduction correct. `Replacement` expression of
`SubstNonTypeTemplateParmExpr` just helps the deduction and may not be
same with the original expression.

Co-authored-by: huqizhi <836744285 at qq.com>



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