[all-commits] [llvm/llvm-project] 3b5e7c: [Clang][Sema] Fix a bug on type constraint checkin...

Qizhi Hu via All-commits all-commits at lists.llvm.org
Wed Mar 13 23:24:48 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b5e7c83a6e226d5bd7ed2e9b67449b64812074c
      https://github.com/llvm/llvm-project/commit/3b5e7c83a6e226d5bd7ed2e9b67449b64812074c
  Author: Qizhi Hu <836744285 at qq.com>
  Date:   2024-03-14 (Thu, 14 Mar 2024)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
    A clang/test/Sema/PR84368.cpp

  Log Message:
  -----------
  [Clang][Sema] Fix a bug on type constraint checking (#84671)

Try to fix https://github.com/llvm/llvm-project/issues/84368
When visiting class members in
`TemplateDeclInstantiator::VisitClassTemplateDecl` during
`Sema::InstantiateClass`, we miss to set attribute of friend declaration
if it is(`isFriend` is true). This will lead to
`Sema::AreConstraintExpressionsEqual` return false when invoked in
`MatchTemplateParameterKind`. Because it makes
`Sema::getTemplateInstantiationArgs` returns incorrect template
argument(`MultiLevelTemplateArgumentList`). When we handle
`CXXRecordDecl` In `Sema::getTemplateInstantiationArgs`, friend
declaration(its parent context is `FileContext`) makes us to choose
`LexicalDeclContext` not `DeclContext` and this is what we want.

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