nataliakokoromyti wrote:
> This expression is VALID.
yes yes good catch, changed the PR description.
> Btw, do you known when `getNamedTypeInfo() == nullptr`, but `NameKind ==
> CXXDestructorName`? Maybe we still need the check from this PR, but why
> `getNamedTypeInfo() == nullptr` for `y->~decltype(A())()` requires additional
> investigation.
I checked the `getNamedTypeInfo() == nullptr` case locally with current LLVM
clang. For this input:
```cpp
struct A { ~A(); };
void b(const A *y) {
y->~decltype(A())();
}
the AST is a normal destructor member call, not a CXXPseudoDestructorExpr:
CXXMemberCallExpr ... 'void'
`-MemberExpr ... '<bound member function type>' ->~A
So this is one case where NameKind == CXXDestructorName but the original
destructor spelling was ~decltype(A()), and the DeclarationNameInfo doesn't
have NamedTypeInfo.
I agree that the null check is still reasonable because other callers already
guard this. A Sema change to preserve source info for this spelling might be
possible, but it seems broader than this crash fix.
https://github.com/llvm/llvm-project/pull/195939
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits