re PR c++/29001 (ICE on invalid return from operator new)

/cp
2007-07-24  Paolo Carlini  <pcarlini@suse.de>

	PR c++/29001
	* typeck.c (check_return_expr): Do not pass a null argument
	to null_ptr_cst_p.

2007-07-24  Paolo Carlini  <pcarlini@suse.de>

	PR c++/32561
	* decl.c (redeclaration_error_message): Call DECL_ANON_UNION_VAR_P
	only on VAR_DECL.

/testsuite
2007-07-24  Paolo Carlini  <pcarlini@suse.de>

	PR c++/29001
	* g++.dg/init/new22.C: New.

2007-07-24  Paolo Carlini  <pcarlini@suse.de>

	PR c++/32561
	* g++.dg/template/crash67.C: New.

From-SVN: r126873
This commit is contained in:
Paolo Carlini 2007-07-24 11:08:27 +00:00 committed by Paolo Carlini
parent 99c9c69acb
commit aedfac0ec9
6 changed files with 31 additions and 3 deletions

View File

@ -1,3 +1,15 @@
2007-07-24 Paolo Carlini <pcarlini@suse.de>
PR c++/29001
* typeck.c (check_return_expr): Do not pass a null argument
to null_ptr_cst_p.
2007-07-24 Paolo Carlini <pcarlini@suse.de>
PR c++/32561
* decl.c (redeclaration_error_message): Call DECL_ANON_UNION_VAR_P
only on VAR_DECL.
2007-07-22 Nathan Sidwell <nathan@codesourcery.com>
PR c++/32839

View File

@ -2195,8 +2195,8 @@ redeclaration_error_message (tree newdecl, tree olddecl)
union { int i; };
is invalid. */
if (DECL_ANON_UNION_VAR_P (newdecl)
|| DECL_ANON_UNION_VAR_P (olddecl))
if ((TREE_CODE (newdecl) == VAR_DECL && DECL_ANON_UNION_VAR_P (newdecl))
|| (TREE_CODE (olddecl) == VAR_DECL && DECL_ANON_UNION_VAR_P (olddecl)))
return "redeclaration of %q#D";
/* If at least one declaration is a reference, there is no
conflict. For example:

View File

@ -6639,7 +6639,7 @@ check_return_expr (tree retval, bool *no_warning)
|| DECL_OVERLOADED_OPERATOR_P (current_function_decl) == VEC_NEW_EXPR)
&& !TYPE_NOTHROW_P (TREE_TYPE (current_function_decl))
&& ! flag_check_new
&& null_ptr_cst_p (retval))
&& retval && null_ptr_cst_p (retval))
warning (0, "%<operator new%> must not return NULL unless it is "
"declared %<throw()%> (or -fcheck-new is in effect)");

View File

@ -1,3 +1,13 @@
2007-07-24 Paolo Carlini <pcarlini@suse.de>
PR c++/29001
* g++.dg/init/new22.C: New.
2007-07-24 Paolo Carlini <pcarlini@suse.de>
PR c++/32561
* g++.dg/template/crash67.C: New.
2007-07-24 Dorit Nuzman <dorit@il.ibm.com>
* lib/target-support.exp (check_effective_target_natural_alignment):

View File

@ -0,0 +1,3 @@
// PR c++/29001
void* operator new (__SIZE_TYPE__) { return; } // { dg-error "with no value" }

View File

@ -0,0 +1,3 @@
// PR c++/32561
template<int N, int N> struct A; // { dg-error "redefinition|declared" }