diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 39da6aaf3ff..f0ea30b7a8b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,15 @@ +2007-07-24 Paolo Carlini + + PR c++/29001 + * typeck.c (check_return_expr): Do not pass a null argument + to null_ptr_cst_p. + +2007-07-24 Paolo Carlini + + PR c++/32561 + * decl.c (redeclaration_error_message): Call DECL_ANON_UNION_VAR_P + only on VAR_DECL. + 2007-07-22 Nathan Sidwell PR c++/32839 diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 8b6684c2e30..e3c70a5c439 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -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: diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 7a1a725b69a..51deeb29444 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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, "% must not return NULL unless it is " "declared % (or -fcheck-new is in effect)"); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 486bc884987..08d34cdef67 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2007-07-24 Paolo Carlini + + PR c++/29001 + * g++.dg/init/new22.C: New. + +2007-07-24 Paolo Carlini + + PR c++/32561 + * g++.dg/template/crash67.C: New. + 2007-07-24 Dorit Nuzman * lib/target-support.exp (check_effective_target_natural_alignment): diff --git a/gcc/testsuite/g++.dg/init/new22.C b/gcc/testsuite/g++.dg/init/new22.C new file mode 100644 index 00000000000..2ce51ff2896 --- /dev/null +++ b/gcc/testsuite/g++.dg/init/new22.C @@ -0,0 +1,3 @@ +// PR c++/29001 + +void* operator new (__SIZE_TYPE__) { return; } // { dg-error "with no value" } diff --git a/gcc/testsuite/g++.dg/template/crash67.C b/gcc/testsuite/g++.dg/template/crash67.C new file mode 100644 index 00000000000..c80f4fb9345 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash67.C @@ -0,0 +1,3 @@ +// PR c++/32561 + +template struct A; // { dg-error "redefinition|declared" }