Added an assertion to constant evaluation enty points that prohibits dependent expressions
Summary:
Constant evaluator does not work on value-dependent or type-dependent
expressions.
Also fixed bugs uncovered by these assertions.
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D61522
llvm-svn: 361050
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index b7ebf31..10829c7 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -2974,6 +2974,9 @@
bool Expr::isConstantInitializer(ASTContext &Ctx, bool IsForRef,
const Expr **Culprit) const {
+ assert(!isValueDependent() &&
+ "Expression evaluator can't be called on a dependent expression.");
+
// This function is attempting whether an expression is an initializer
// which can be evaluated at compile-time. It very closely parallels
// ConstExprEmitter in CGExprConstant.cpp; if they don't match, it