re PR c++/44628 (ICE in cp_build_unary_op at cp/typeck.c:4671)

/cp
2010-06-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/44628
	* typeck.c (cp_build_unary_op): Early return error_mark_node when
	arg is NULL_TREE too.
	* call.c (convert_class_to_reference): Return error_mark_node when
	expr is NULL_TREE.

/testsuite
2010-06-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/44628
	* g++.dg/template/crash100.C: New.

From-SVN: r161639
This commit is contained in:
Paolo Carlini 2010-06-30 20:46:46 +00:00
parent a87cf97e0d
commit fb80065cb3
5 changed files with 43 additions and 3 deletions

View File

@ -1,6 +1,14 @@
2010-06-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/44628
* typeck.c (cp_build_unary_op): Early return error_mark_node when
arg is NULL_TREE too.
* call.c (convert_class_to_reference): Return error_mark_node when
expr is NULL_TREE.
2010-06-30 Michael Matz <matz@suse.de>
* repo.c ((finish_repo): Fix typo.
* repo.c (finish_repo): Fix typo.
2010-06-30 Nathan Froyd <froydnj@codesourcery.com>
@ -17,7 +25,7 @@
* tree.c: Include gimple.h. Do not include tree-flow.h
* decl.c: Do not include tree-flow.h
* Make-lang.in: Adjust dependencies.
2010-06-29 Nathan Froyd <froydnj@codesourcery.com>
* decl.c (incomplete_var): Declare. Declare VECs containing them.

View File

@ -1040,6 +1040,9 @@ convert_class_to_reference (tree reference_type, tree s, tree expr, int flags)
struct z_candidate *cand;
bool any_viable_p;
if (!expr)
return NULL;
conversions = lookup_conversions (s, /*lookup_template_convs_p=*/true);
if (!conversions)
return NULL;

View File

@ -4781,7 +4781,7 @@ cp_build_unary_op (enum tree_code code, tree xarg, int noconvert,
tree val;
const char *invalid_op_diag;
if (error_operand_p (arg))
if (!arg || error_operand_p (arg))
return error_mark_node;
if ((invalid_op_diag

View File

@ -1,3 +1,8 @@
2010-06-30 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/44628
* g++.dg/template/crash100.C: New.
2010-06-30 Jan Hubicka <jh@suse.cz>
* gcc.dg/tree-ssa/ipa-split-4.c: New testcase.

View File

@ -0,0 +1,24 @@
// PR c++/44628
template <typename T>
class Temp
{
int Val;
public:
operator T&(void) { return Val; }
virtual T& operator=(T a ) // { dg-error "overriding" }
{
Val = a;
return Val;
}
};
class Int : public Temp<int>
{
public:
Int& operator=(int a) // { dg-error "conflicting return type" }
{
return (*this);
}
};