hokein added inline comments.

================
Comment at: clang/lib/Sema/SemaDecl.cpp:14359
+        !ErrorsInCtorInitializer &&
         !CheckConstexprFunctionDefinition(FD, CheckConstexprKind::Diagnose))
       FD->setInvalidDecl();
----------------
The crash is in `CheckConstexprFunctionDefinition`, I tried different ways to 
fixing it:

1) mark `FD` invalid when there are any errors in CtorInitailizer -- clang 
deliberately treats CtorDecl as valid even there are some errors in the 
initializer to prevent spurious diagnostics (see the cycle delegation in the 
test as an example), so marking them invalid may affect the quality of 
diagnostics;

2) Fixing it inside `CheckConstexprFunctionDefinition` or 
`isPotentialConstantExpr`, but it doesn't seem to be a right layer, these 
functions are expected to be called on a validDecl (or at least after a few 
sanity checks), and emit diagnostics.


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