[PATCH] D52926: Rename EM_ConstantExpressionUnevaluated to EM_ConstantFoldUnevaluated, which is actually what the code is currently doing.

James Y Knight via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 4 22:48:37 PDT 2018


jyknight created this revision.
jyknight added a reviewer: rsmith.

And, configure it to explicitly request equivalent behavior to
ConstantFold, instead of getting that behavior accidentally.

While it seems that diagnose_if and enable_if were intended to require
a constexpr argument, the code was actually only checking whether it
could be constant-folded, due to the confusing way the constant
evaluator code currently works.

It _probably_ should be fixed to actually check for
constexpr-ness. However, r290584 now depends on it NOT doing so -- and
it's possible that some users are, too.

I'd like to land this, to unblock the follow-on cleanup -- without
changing the semantics first -- and maybe loop back to convert it to
require a constexpr later, if it looks like users aren't depending on
the semantics it has now.

This change is a prerequisite for fixing the confusion in the
ExprConstant code which led to this situation.


https://reviews.llvm.org/D52926

Files:
  clang/lib/AST/ExprConstant.cpp
  clang/test/Sema/enable_if.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52926.168437.patch
Type: text/x-patch
Size: 6257 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181005/7de1296e/attachment.bin>


More information about the cfe-commits mailing list