[PATCH] D132712: [Clang] Fix assert in Sema::LookupTemplateName so that it does not attempt an unconditional cast to TagType
Erich Keane via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 26 05:59:50 PDT 2022
erichkeane accepted this revision.
erichkeane added a comment.
Looking through `isCompleteType` I note that arrays of an elements of incomplete types would have also hit this crash, as would member-pointers in MicrosoftABI (in some weird cases?), and some ObjC types.
Anyway, other than the nit above, LGTM.
================
Comment at: clang/lib/Sema/SemaTemplate.cpp:401
IsDependent = !LookupCtx && ObjectType->isDependentType();
- assert((IsDependent || !ObjectType->isIncompleteType() ||
+ assert((IsDependent || !ObjectType->getAs<TagType>() ||
+ !ObjectType->isIncompleteType() ||
----------------
Slight preference for making the `getAs` happen after the completeness check, since that is in the 'order of costliness'.
Also, not sure the assert message here makes any sense, but I don't know of anything better here.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132712/new/
https://reviews.llvm.org/D132712
More information about the cfe-commits
mailing list