[clang] [Clang][Sema] fix a bug on constraint check with template friend function (PR #90646)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 30 13:20:14 PDT 2024


sdkrystian wrote:

I'm actually working on constraint checking for function template specializations in #88963. I don't think this patch is quite right... this will cause a crash if the befriended function is a member of a class template specialization. Relative to the changes in #88963, I believe the correct fix would be to change line 278 to:
```cpp
if (RelativeToPrimary &&
    (Function->getTemplateSpecializationKind() ==
         TSK_ExplicitSpecialization ||
     (Function->getFriendObjectKind() &&
      !Function->getPrimaryTemplate()->getFriendObjectKind())))
  return Response::UseNextDecl(Function);
```
I added a commit to #88963 which makes this change (be79079507ffbd9b29683498f405dc2c32dd8ba7)

https://github.com/llvm/llvm-project/pull/90646


More information about the cfe-commits mailing list