[PATCH] D23493: Fix PR28366: Teach the const-expression evaluator to be more fault tolerant with non-const enclosing local variables, or otherwise fold them if const.

Faisal Vali via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 18 20:06:40 PDT 2016


faisalv added a comment.

Address Richard's comments.


================
Comment at: lib/Sema/SemaTemplateInstantiateDecl.cpp:190
@@ -189,3 +189,3 @@
   if (A->getCond()->isValueDependent() && !Cond->isValueDependent() &&
-      !Expr::isPotentialConstantExprUnevaluated(Cond, cast<FunctionDecl>(Tmpl),
+      !Expr::isPotentialConstantExprUnevaluated(Cond, cast<FunctionDecl>(New),
                                                 Diags)) {
----------------
rsmith wrote:
> Do we have existing test coverage for this (tests that fail with the ExprConstant change if we don't fix this at the same time)?
Yes we do.  That's how I realized it needed to be fixed - it's enable_if.cpp in SemaCXX that has the following test:
template <typename T> T templatedBar(T m) attribute((enable_if(m > 0, ""))) { return T(); }



https://reviews.llvm.org/D23493





More information about the cfe-commits mailing list