PR27989: only enqueue binary operators into the data recursive int expression

evaluator if they are actually int expressions.

llvm-svn: 271754
This commit is contained in:
Richard Smith 2016-06-04 00:22:31 +00:00
parent 2905d54af3
commit 3a09d8be7c
2 changed files with 11 additions and 1 deletions

View File

@ -7112,7 +7112,9 @@ public:
static bool shouldEnqueue(const BinaryOperator *E) {
return E->getOpcode() == BO_Comma ||
E->isLogicalOp() ||
(E->getLHS()->getType()->isIntegralOrEnumerationType() &&
(E->isRValue() &&
E->getType()->isIntegralOrEnumerationType() &&
E->getLHS()->getType()->isIntegralOrEnumerationType() &&
E->getRHS()->getType()->isIntegralOrEnumerationType());
}

View File

@ -949,3 +949,11 @@ namespace SpeculativeEvalWrites {
static_assert(!f(), "");
}
namespace PR27989 {
constexpr int f(int n) {
int a = (n = 1, 0);
return n;
}
static_assert(f(0) == 1, "");
}