[PATCH] D131541: [Sema] Fix friend destructor declarations after D130936

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 10 20:48:48 PDT 2022


hubert.reinterpretcast added inline comments.


================
Comment at: clang/lib/Sema/SemaDecl.cpp:11522
+      if (NewFD->getFriendObjectKind() == Decl::FriendObjectKind::FOK_None ||
+          !NewFD->isDependentContext()) {
+        QualType ClassType = Destructor->getThisObjectType();
----------------
This condition appears to be true even when the friend itself is not dependent. The error message changes for:
```
struct C;
struct B { ~B(); };
template <typename T>
struct A {
  friend B::~C();
};
```

(causing the template and non-template cases to generate different messages).



================
Comment at: clang/test/SemaCXX/member-class-11.cpp:36-40
+// FIXME: We should diagnose here.
+template <typename T>
+struct E {
+  friend T::S::~V();
+};
----------------
Please replace this with the case where there is an instantiation. Also, the prior change to the release notes in https://reviews.llvm.org/D130936 should be adjusted to reflect the new scope of what is fixed.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131541/new/

https://reviews.llvm.org/D131541



More information about the cfe-commits mailing list