rsmith added inline comments.

================
Comment at: clang/include/clang/AST/Expr.h:103
+/// Contexts in which a converted constant expression is required.
+enum CCEKind {
+  CCEK_CaseValue,   ///< Expression in a case label.
----------------
If we end up moving this out of `Sema` into the `clang` namespace, it needs a 
longer name than this.


================
Comment at: clang/include/clang/AST/Expr.h:670-672
+  /// Evaluate an expression that is required to be a core constant expression.
+  bool EvaluateAsCoreConstExpr(EvalResult &Result, QualType ParamType,
+                               CCEKind CCE, const ASTContext &Ctx) const;
----------------
Seems strange to pass a converted constant expression kind to an 'evaluate as 
core constant expression' function. And it seems like we don't need the kind 
here, just an "evaluating for emission w/relocations" vs "evaluating for 
mangling" enum.

Also, we need to evaluate non-type template arguments as constant expressions, 
not just as core constant expressions, which the implementation does, but the 
name and comment here don't reflect. (The difference is that you can't result 
in a pointer/reference to a temporary or automatic / thread storage duration 
entity.)


https://reviews.llvm.org/D43320



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D43320: A... Reid Kleckner via Phabricator via cfe-commits
    • [PATCH] D433... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D433... Richard Smith - zygoloid via Phabricator via cfe-commits
    • [PATCH] D433... Reid Kleckner via Phabricator via cfe-commits
    • [PATCH] D433... Reid Kleckner via Phabricator via cfe-commits
    • [PATCH] D433... Richard Smith - zygoloid via Phabricator via cfe-commits

Reply via email to