Unverified Commit 3b5e7c83 authored by Qizhi Hu's avatar Qizhi Hu Committed by GitHub
Browse files

[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: default avatarhuqizhi <836744285@qq.com>
parent fef62be0
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment