Commit c2985fe5 by Paolo Carlini Committed by Paolo Carlini

re PR c++/51326 (ICE with invalid override)

/cp
2011-12-01  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51326
	* call.c (build_user_type_conversion_1): Early return NULL if
	expr is NULL_TREE.

/testsuite
2011-12-01  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/51326
	* g++.dg/inherit/crash3.C: New.

From-SVN: r181895
parent c21e80b8
2011-12-01 Paolo Carlini <paolo.carlini@oracle.com> 2011-12-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51326
* call.c (build_user_type_conversion_1): Early return NULL if
expr is NULL_TREE.
2011-12-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51367 PR c++/51367
* pt.c (unify_inconsistency): Use either %qT or %qE depending on * pt.c (unify_inconsistency): Use either %qT or %qE depending on
whether parm is a type or non-type parameter. whether parm is a type or non-type parameter.
......
...@@ -3373,7 +3373,7 @@ static struct z_candidate * ...@@ -3373,7 +3373,7 @@ static struct z_candidate *
build_user_type_conversion_1 (tree totype, tree expr, int flags) build_user_type_conversion_1 (tree totype, tree expr, int flags)
{ {
struct z_candidate *candidates, *cand; struct z_candidate *candidates, *cand;
tree fromtype = TREE_TYPE (expr); tree fromtype;
tree ctors = NULL_TREE; tree ctors = NULL_TREE;
tree conv_fns = NULL_TREE; tree conv_fns = NULL_TREE;
conversion *conv = NULL; conversion *conv = NULL;
...@@ -3382,6 +3382,11 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags) ...@@ -3382,6 +3382,11 @@ build_user_type_conversion_1 (tree totype, tree expr, int flags)
bool any_viable_p; bool any_viable_p;
int convflags; int convflags;
if (!expr)
return NULL;
fromtype = TREE_TYPE (expr);
/* We represent conversion within a hierarchy using RVALUE_CONV and /* We represent conversion within a hierarchy using RVALUE_CONV and
BASE_CONV, as specified by [over.best.ics]; these become plain BASE_CONV, as specified by [over.best.ics]; these become plain
constructor calls, as specified in [dcl.init]. */ constructor calls, as specified in [dcl.init]. */
......
2011-12-01 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/51326
* g++.dg/inherit/crash3.C: New.
2011-12-01 Nathan Sidwell <nathan@acm.org> 2011-12-01 Nathan Sidwell <nathan@acm.org>
PR gcov-profile/51113 PR gcov-profile/51113
......
// PR c++/51326
struct A
{
virtual int& foo(); // { dg-error "overriding" }
};
struct B : A
{
B& foo(); // { dg-error "conflicting return type" }
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment