backport: re PR c++/71871 (ICE on mixing templates and vector extensions ternary operator)

Backported from mainline
	2016-07-18  Jakub Jelinek  <jakub@redhat.com>

	PR c++/71871
	* typeck.c (build_x_conditional_expr): Revert the 2012-10-25 change.

	* g++.dg/ext/vector31.C: New test.

From-SVN: r238464
This commit is contained in:
Jakub Jelinek 2016-07-19 11:25:10 +02:00 committed by Jakub Jelinek
parent 33800c8d66
commit 966f872069
4 changed files with 43 additions and 2 deletions

View File

@ -1,3 +1,11 @@
2016-07-19 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2016-07-18 Jakub Jelinek <jakub@redhat.com>
PR c++/71871
* typeck.c (build_x_conditional_expr): Revert the 2012-10-25 change.
2016-07-07 Jakub Jelinek <jakub@redhat.com>
Backported from mainline

View File

@ -6125,8 +6125,7 @@ build_x_conditional_expr (location_t loc, tree ifexp, tree op1, tree op2,
}
expr = build_conditional_expr (loc, ifexp, op1, op2, complain);
if (processing_template_decl && expr != error_mark_node
&& TREE_CODE (expr) != VEC_COND_EXPR)
if (processing_template_decl && expr != error_mark_node)
{
tree min = build_min_non_dep (COND_EXPR, expr,
orig_ifexp, orig_op1, orig_op2);

View File

@ -1,6 +1,11 @@
2016-07-19 Jakub Jelinek <jakub@redhat.com>
Backported from mainline
2016-07-18 Jakub Jelinek <jakub@redhat.com>
PR c++/71871
* g++.dg/ext/vector31.C: New test.
2016-07-11 Jakub Jelinek <jakub@redhat.com>
PR middle-end/71758

View File

@ -0,0 +1,29 @@
// PR c++/71871
// { dg-do compile }
typedef unsigned int V __attribute__ ((__vector_size__ (32)));
template <int N>
void
foo (V *x)
{
V a = *x;
a = a ? a : -1;
*x = a;
}
template <typename T>
void
bar (T *x)
{
T a = *x;
a = a ? a : -1;
*x = a;
}
void
test (V *x, V *y)
{
foo<0> (x);
bar<V> (y);
}