[PATCH] D16630: PR23057: Fix assertion `Val && "isa<> used on a null pointer"' on invalid for-range expression

Denis Zobnin via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 2 02:21:20 PST 2016


d.zobnin.bugzilla added inline comments.

================
Comment at: lib/Parse/ParseStmt.cpp:1719-1724
@@ -1718,6 +1718,8 @@
   if (ForRange) {
+    ExprResult CorrectedRange =
+        Actions.CorrectDelayedTyposInExpr(ForRangeInit.RangeExpr.get());
     ForRangeStmt = Actions.ActOnCXXForRangeStmt(
         getCurScope(), ForLoc, CoawaitLoc, FirstPart.get(),
-        ForRangeInit.ColonLoc, ForRangeInit.RangeExpr.get(),
+        ForRangeInit.ColonLoc, CorrectedRange.get(),
         T.getCloseLocation(), Sema::BFRK_Build);
 
----------------
majnemer wrote:
> Does this change effect all of the test cases you've added? If not, I think it would make sense to split this change out.
Yes, this change is needed in all added test cases.
Without this we will have an assertion failure in ~Sema():

```
assert(DelayedTypos.empty() && "Uncorrected typos!");
```


http://reviews.llvm.org/D16630





More information about the cfe-commits mailing list