We didn't check that a destructor's name matches the directly enclosing class if the class was dependent.
I enabled the check we already had for non-dependent types, which seems to work. Added appropriate tests.
Fixes GitHub issue #56772
Differential D130936
[SemaCXX] Validate destructor is valid for dependent classes Authored by royjacobson on Aug 1 2022, 1:49 PM.
Details We didn't check that a destructor's name matches the directly enclosing class if the class was dependent. Fixes GitHub issue #56772
Diff Detail
Event TimelineComment Actions LGTM but let's have Erich take a look.
Comment Actions Hmm... I'm a little shocked that didn't error before, while we did the 2nd pass through the destructor. A little shocking this made it this far... The fix looks fine to me, I wish I knew why we had that check there, but I got lost in the subversion history. Anyway, LGTM with 1 nit.. ALSO needs a release note.
Comment Actions This does not work for friend declarations. template <typename T>
struct A {
friend T::S::~S();
private:
static constexpr int secret = 42;
};
struct Q {
struct S { ~S(); };
};
Q::S::~S() {
void foo(int);
foo(A<Q>::secret);
} | ||||||||||||
The FIXME goes back a while, I wonder how long ago we fixed this.