[PATCH] D77041: [AST] Fix a crash on invalid constexpr Ctorinitializer when building RecoveryExpr.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 31 07:44:43 PDT 2020


hokein marked an inline comment as done.
hokein added inline comments.


================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:5004
     CXXCtorInitializer *Member = Initializers[i];
-
+    if (Member->getInit() && Member->getInit()->containsErrors())
+      Constructor->setInvalidDecl();
----------------
sammccall wrote:
> what's the case where this gets hit rather than anyerrors=true?
no cases, if `Member->getInit()->containsErrors()` is true, then `anyerrors` is always true (this is done in `ParseDeclCXX.cpp`).

the reason why we added the check here is that we mark the constructor as invalid only for case `Member->getInit()->containsErrors()` (not for other cases leading `anyerrors` to true)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77041





More information about the cfe-commits mailing list