Hello,
here is a simple patch for error recovery. We already check the arguments
earlier, but force_rvalue can replace them with errors.
Bootstrap+testsuite on x86_64-unknown-linux-gnu.
2014-01-01 Marc Glisse <[email protected]>
PR c++/59641
gcc/cp/
* call.c (build_conditional_expr_1): Check the return value of
force_rvalue.
gcc/testsuite/
* g++.dg/cpp0x/pr59641.C: New file.
--
Marc GlisseIndex: gcc/cp/call.c
===================================================================
--- gcc/cp/call.c (revision 206265)
+++ gcc/cp/call.c (working copy)
@@ -4395,20 +4395,26 @@ build_conditional_expr_1 (location_t loc
orig_arg2 = arg2;
orig_arg3 = arg3;
if (VECTOR_INTEGER_TYPE_P (TREE_TYPE (arg1)))
{
arg1 = force_rvalue (arg1, complain);
arg2 = force_rvalue (arg2, complain);
arg3 = force_rvalue (arg3, complain);
+ /* force_rvalue can return error_mark on valid arguments. */
+ if (error_operand_p (arg1)
+ || error_operand_p (arg2)
+ || error_operand_p (arg3))
+ return error_mark_node;
+
tree arg1_type = TREE_TYPE (arg1);
arg2_type = TREE_TYPE (arg2);
arg3_type = TREE_TYPE (arg3);
if (TREE_CODE (arg2_type) != VECTOR_TYPE
&& TREE_CODE (arg3_type) != VECTOR_TYPE)
{
/* Rely on the error messages of the scalar version. */
tree scal = build_conditional_expr_1 (loc, integer_one_node,
orig_arg2, orig_arg3, complain);
Index: gcc/testsuite/g++.dg/cpp0x/pr59641.C
===================================================================
--- gcc/testsuite/g++.dg/cpp0x/pr59641.C (revision 0)
+++ gcc/testsuite/g++.dg/cpp0x/pr59641.C (working copy)
@@ -0,0 +1,8 @@
+// { dg-options "-std=gnu++11" }
+typedef int T __attribute__((vector_size(2*sizeof(int))));
+
+void foo(T& r, const T& a, const T& b)
+{
+ constexpr T c = a < b; // { dg-error "constant" }
+ r = c ? a : b;
+}
Property changes on: gcc/testsuite/g++.dg/cpp0x/pr59641.C
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Author Date Id Revision URL
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property