Split apart the state accumulated during constant expression evaluation and the
end result. Use this split to propagate state information and diagnostics
through more of constant expression evaluation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@142159 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/constant-expression.cpp b/test/SemaCXX/constant-expression.cpp
index 1341036..e3f45c5 100644
--- a/test/SemaCXX/constant-expression.cpp
+++ b/test/SemaCXX/constant-expression.cpp
@@ -85,3 +85,13 @@
a = sizeof(int) == 8,
b = a? 8 : 4
};
+
+void diags(int n) {
+ switch (n) {
+ case (1/0, 1): // expected-error {{not an integer constant expression}} expected-note {{division by zero}}
+ case (int)(1/0, 2.0): // expected-error {{not an integer constant expression}} expected-note {{division by zero}}
+ case __imag(1/0): // expected-error {{not an integer constant expression}} expected-note {{division by zero}}
+ case (int)__imag((double)(1/0)): // expected-error {{not an integer constant expression}} expected-note {{division by zero}}
+ ;
+ }
+}