[PATCH] D43320: Allow dllimport non-type template arguments in C++17

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 15 18:47:55 PST 2018


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





More information about the cfe-commits mailing list