PR11604: don't allow floating-literal-to-integer casts in ICEs if the (truncated)
floating literal value does not fit into the destination type. Such casts have
undefined behavior at translation time; treating them as non-ICE matches the
behavior of modern gcc versions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@146842 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaCXX/constant-expression.cpp b/test/SemaCXX/constant-expression.cpp
index 2d2f1ae..0367cc55 100644
--- a/test/SemaCXX/constant-expression.cpp
+++ b/test/SemaCXX/constant-expression.cpp
@@ -102,3 +102,9 @@
   template<int n> struct S {};
   S<p> s; // expected-error {{not an integral constant expression}}
 }
+
+namespace FloatConvert {
+  typedef int a[(int)42.3];
+  typedef int a[(int)42.997];
+  typedef int b[(int)4e10]; // expected-error {{variable length}}
+}