[PATCH] D82738: [clang] Fix a null-NSS-access crash in DependentNameType.

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 2 05:20:45 PDT 2020


sammccall accepted this revision.
sammccall added a subscriber: rsmith.
sammccall added a comment.
This revision is now accepted and ready to land.

Yeah, I think you're right, and this small version of the patch seems good.

> if the arg is a DeclRefExpr (no typo correction), we'll never into this branch - the lookup should find the responding ValueDecl, which is not a TypeDecl

I think this is true but I don't feel certain. @rsmith could think of an exception if anyone can. (Only important if the exception is common enough we really need to offer the `typename` recovery.

Agree that if we've already done typo correction then offering further recovery isn't necessary and in fact often does more harm than good.



================
Comment at: clang/lib/Sema/SemaTemplate.cpp:4866
               LookupResult::NotFoundInCurrentInstantiation) {
+        assert(SS.getScopeRep() && "A scope specifier must be present.");
         // Suggest that the user add 'typename' before the NNS.
----------------
Assertion message doesn't really say anything more than the assertion itself.
Instead of saying what, can we say why?

(DependentScopeDeclRefExpr must be relative to some specified scope!)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D82738





More information about the cfe-commits mailing list