[PATCH] D54550: Mark lambda decl as invalid if a captured variable has an invalid type.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 20 21:51:14 PST 2018


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

Looks good, thanks! (Though we generally prefer fewer test files with more test per file, because a lot of the overhead of running tests is the setup / teardown time, so can you merge the two added tests into a single file?)



================
Comment at: clang/lib/Sema/SemaExpr.cpp:14952-14958
+      NamedDecl *Def;
+      EltTy->isIncompleteType(&Def);
+      if (Def && Def->isInvalidDecl()) {
+        Lambda->setInvalidDecl();
+        Field->setInvalidDecl();
+      }
+    }
----------------
jgorbe wrote:
> rsmith wrote:
> > I believe the `else` case here is redundant: if `RequireCompleteType` returns `false`, the type is complete and there's nothing more you need to do.
> If I just remove the `else` block, the test case included with the patch keeps crashing. Is there any way a `Decl` can be invalid even after `RequireCompleteType` returns `false`?
I think I was just wrong before :) Looks like `RequireCompleteType` doesn't check whether the type is invalid.


https://reviews.llvm.org/D54550





More information about the cfe-commits mailing list