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

================
Comment at: clang/lib/AST/ExprConstant.cpp:4961
     }
+    if (IS->getCond()->isValueDependent())
+      return EvaluateDependentExpr(IS->getCond(), Info);
----------------
The `if` stmt (the same to `while`, `for`) is tricky -- if the condition is 
value-dependent, then we don't know which branch we should run into.

- returning a ESR_Succeeded may lead to a bogus diagnostic ("reach the end of 
the function");
- returning a ESR_Failed may lead to a bogus diagnostic ("never produce a 
constexpr"); 

I guess what we want is to stop the evaluation, and indicate that we hit a 
value-dependent expression and we don't know how to evaluate it, but still 
treat the constexpr function as potential constexpr (but no extra diagnostics 
being emitted), but the current `EvalStmtResult` is not sufficient, maybe we 
need a new enum.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84637

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

Reply via email to