re PR c++/71835 (ICE on invalid C++ code with ambiguous overloaded operators: tree check: expected tree that contains ‘decl minimal’ structure, have ‘pointer_type’ in convert_like_real, at cp/call.c:6549)

PR c++/71835
	* call.c (build_op_call_1): Use convert_like_with_context only
	if cand->fn is a decl.

	* g++.dg/conversion/ambig3.C: New test.

From-SVN: r238443
This commit is contained in:
Jakub Jelinek 2016-07-18 20:44:51 +02:00 committed by Jakub Jelinek
parent 87713c6a50
commit 99516432c2
4 changed files with 25 additions and 2 deletions

View File

@ -1,5 +1,9 @@
2016-07-18 Jakub Jelinek <jakub@redhat.com>
PR c++/71835
* call.c (build_op_call_1): Use convert_like_with_context only
if cand->fn is a decl.
PR c++/71828
* constexpr.c (cxx_eval_constant_expression) <case REALPART_EXPR>:
For lval don't use cxx_eval_unary_expression and instead recurse

View File

@ -4412,8 +4412,11 @@ build_op_call_1 (tree obj, vec<tree, va_gc> **args, tsubst_flags_t complain)
result = build_over_call (cand, LOOKUP_NORMAL, complain);
else
{
obj = convert_like_with_context (cand->convs[0], obj, cand->fn, -1,
complain);
if (DECL_P (cand->fn))
obj = convert_like_with_context (cand->convs[0], obj, cand->fn,
-1, complain);
else
obj = convert_like (cand->convs[0], obj, complain);
obj = convert_from_reference (obj);
result = cp_build_function_call_vec (obj, args, complain);
}

View File

@ -1,5 +1,8 @@
2016-07-18 Jakub Jelinek <jakub@redhat.com>
PR c++/71835
* g++.dg/conversion/ambig3.C: New test.
PR c++/71828
* g++.dg/cpp0x/constexpr-71828.C: New test.

View File

@ -0,0 +1,13 @@
// PR c++/71835
// { dg-do compile }
typedef void T (int);
struct A { operator T * (); }; // { dg-message "candidate" }
struct B { operator T * (); }; // { dg-message "candidate" }
struct C : A, B {} c;
void
foo ()
{
c (0); // { dg-error "is ambiguous" }
}