rsmith added inline comments.

================
Comment at: clang/lib/Sema/SemaDeclCXX.cpp:5005
+    if (Member->getInit() && Member->getInit()->containsErrors())
+      Constructor->setInvalidDecl();
     if (Member->isBaseInitializer())
----------------
rsmith wrote:
> This is inappropriate. The "invalid" bit on a declaration indicates whether 
> the declaration is invalid, not whether the definition is invalid.
> 
> What we should do is add a "contains errors" bit to `Stmt`, and mark the 
> function body as containing errors if it has an initializer that contains an 
> error.
As an example of why this distinction matters: the "contains errors" bit 
indicates whether external users of the declaration should ignore it / suppress 
errors on it, or whether they can still treat it as a regular declaration. It's 
not ideal for an error in the body of a function to affect the diagnostic 
behavior of a caller to that function, since the body is (typically) irrelevant 
to the validity of that caller.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77041



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to