re PR c++/50961 (Fails to decay template function properly(?))

/cp
2014-07-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50961
	* call.c (standard_conversion): Use resolve_nondeduced_context
	for type_unknown_p (EXPR) && TREE_CODE (TO) == BOOLEAN_TYPE.

/testsuite
2014-07-17  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/50961
	* g++.dg/template/operator13.C: New.

From-SVN: r212760
This commit is contained in:
Paolo Carlini 2014-07-17 16:22:19 +00:00 committed by Paolo Carlini
parent 37738b0fe4
commit 835dee55a1
4 changed files with 38 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2014-07-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50961
* call.c (standard_conversion): Use resolve_nondeduced_context
for type_unknown_p (EXPR) && TREE_CODE (TO) == BOOLEAN_TYPE.
2014-07-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/61804

View File

@ -1107,14 +1107,22 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
to = strip_top_quals (to);
from = strip_top_quals (from);
if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to))
&& expr && type_unknown_p (expr))
if (expr && type_unknown_p (expr))
{
tsubst_flags_t tflags = tf_conv;
expr = instantiate_type (to, expr, tflags);
if (expr == error_mark_node)
return NULL;
from = TREE_TYPE (expr);
if (TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to))
{
tsubst_flags_t tflags = tf_conv;
expr = instantiate_type (to, expr, tflags);
if (expr == error_mark_node)
return NULL;
from = TREE_TYPE (expr);
}
else if (TREE_CODE (to) == BOOLEAN_TYPE)
{
/* Necessary for eg, TEMPLATE_ID_EXPRs (c++/50961). */
expr = resolve_nondeduced_context (expr);
from = TREE_TYPE (expr);
}
}
fcode = TREE_CODE (from);

View File

@ -1,3 +1,8 @@
2014-07-17 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/50961
* g++.dg/template/operator13.C: New.
2014-07-17 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* gcc.target/aarch64/simd/vfma_f64.c: New test.

View File

@ -0,0 +1,12 @@
// PR c++/50961
template < class > void foo ();
bool b1 = !foo<void>;
bool b2 = foo<void> ? true : false;
void bar()
{
if (foo<void>)
;
}