[PATCH] D21145: [Sema] Fix crash on valid where instantiation of lambda cannot access type of 'this'

Faisal Vali via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 26 06:46:15 PDT 2016

faisalv accepted this revision.
faisalv added a comment.
This revision is now accepted and ready to land.

With the assert, I would feel comfortable committing the patch.  It always helps to get Richard's approval too - so feel free to ping him aggressively to see if he's interested in stopping it from being committed.

Also, I spoke with Richard & Hubert briefly at the Standards meeting in Oulu about dropping CXXThisTypeOverride - they're not sure whether we can entirely drop it (because of noexcept operands and trailing return types) without some other ugliness - but I'll try and investigate  that at some point (unless you're interested in looking into it).

Thanks again Erik!

Comment at: lib/Sema/SemaExprCXX.cpp:971
@@ +970,3 @@
+  if (ThisTy.isNull() && isLambdaCallOperator(CurContext) &&
+      !ActiveTemplateInstantiations.empty()) {
I wouldn't mind an assertion here that 'DC' is a CXXRecordDecl if you think this branch can only be triggered if that's the case.  Like you, I can't readily think of a case where getCurrentThisType would need to be called while 'transforming' or 'parsing' a lambda and getFunctionLevelDeclContext would not return either a CXXMethorDecl or a CXXRecordDecl (assuming ThisTy is null).  


More information about the cfe-commits mailing list