[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
Wed Nov 14 15:30:55 PST 2018
rsmith added a comment.
Thanks!
================
Comment at: clang/lib/Sema/SemaExpr.cpp:14946
+ // as invalid as well.
+ if (const CXXRecordDecl *RD = FieldType->getAsCXXRecordDecl()) {
+ if (RD->isInvalidDecl()) {
----------------
You'll need to use `FieldType->getBaseElementTypeUnsafe()` or similar here to handle the case where the field type is an array whose element type is a class. (That can happen in a lambda if you capture a local array variable by value.)
================
Comment at: clang/lib/Sema/SemaExpr.cpp:14948
+ if (RD->isInvalidDecl()) {
+ Lambda->setInvalidDecl();
+ }
----------------
For consistency with the class case, I think we should mark the field invalid in this case too.
Repository:
rC Clang
https://reviews.llvm.org/D54550
More information about the cfe-commits
mailing list