aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/constexpr.cc9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-104472.C9
2 files changed, 12 insertions, 6 deletions
diff --git a/gcc/cp/constexpr.cc b/gcc/cp/constexpr.cc
index 9b8e0ec..87f3a7b 100644
--- a/gcc/cp/constexpr.cc
+++ b/gcc/cp/constexpr.cc
@@ -1840,13 +1840,10 @@ cxx_eval_internal_function (const constexpr_ctx *ctx, tree t,
false, non_constant_p,
overflow_p);
if (TREE_CODE (arg) == VECTOR_CST)
- return fold_const_call (CFN_VEC_CONVERT, TREE_TYPE (t), arg);
- else
- {
- *non_constant_p = true;
- return t;
- }
+ if (tree r = fold_const_call (CFN_VEC_CONVERT, TREE_TYPE (t), arg))
+ return r;
}
+ /* FALLTHRU */
default:
if (!ctx->quiet)
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-104472.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-104472.C
new file mode 100644
index 0000000..c9c8bf4
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-104472.C
@@ -0,0 +1,9 @@
+// PR c++/104472
+// { dg-options "-O2 -frounding-math" }
+// { dg-add-options float16 }
+// { dg-require-effective-target float16 }
+
+typedef short __attribute__((__vector_size__ (16))) V;
+typedef _Float16 __attribute__((__vector_size__ (16))) F;
+
+V v = __builtin_convertvector (__builtin_convertvector ((V){5534}, F), V) < 8;