legitimately has side-effects (and needs to be generated as a non-constant).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@88767
91177308-0d34-0410-b5e6-
96231b3b80d8
else
Success = E->Evaluate(Result, Context);
- if (Success) {
- assert(!Result.HasSideEffects &&
- "Constant expr should not have any side effects!");
+ if (Success && !Result.HasSideEffects) {
switch (Result.Val.getKind()) {
case APValue::Uninitialized:
assert(0 && "Constant expressions should be initialized.");
--- /dev/null
+// RUN: clang-cc -emit-llvm-only -verify %s
+
+// Make sure we don't crash generating y; its value is constant, but the
+// initializer has side effects, so EmitConstantExpr should fail.
+int x();
+int y = x() && 0;