[clang] [clang] fix a crash for uses of a pseudo-destructor of enum without definition (PR #210424)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 17 14:52:22 PDT 2026
================
@@ -41,7 +41,7 @@ static CXXRecordDecl *getCurrentInstantiationOf(QualType T,
DeclContext *Sema::computeDeclContext(QualType T) {
if (!T->isDependentType())
- if (auto *D = T->getAsTagDecl())
+ if (auto *D = T->getAsRecordDecl())
----------------
mizvekov wrote:
> Ah, hmm.... it is unfortunately a horrifically generic sounding function (`computeDeclContext`) that doesn't make this clear. I wonder if we should rename this in a way that shows it is ONLY for the purposes of member-access? Or inline-it into its use?
I agree this could be refactored, but I was trying to balance that fact with the need for a smaller change that can be backported, although maybe we are so early in the branch it doesn't matter now?
> Also/also-- I find myself a bit concerned what this DOES give instead. Presumably `getCurrentInstantiationOf` will return `nullptr` for enums now ?
But that has always been the case, the injected class type mechanism has never been applied to enums.
The benefit it provides, allowing lookup into dependent entities within their own definition, is not a lot of help for enums.
https://github.com/llvm/llvm-project/pull/210424
More information about the cfe-commits
mailing list