summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-24 11:08:27 +0000
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>2007-07-24 11:08:27 +0000
commit7a1eab9a80fa1536416212d23e43710d174e4ef7 (patch)
tree503acabc1c43a65ac6911adf51904ed5cf9e3a08 /gcc
parent0e87db7686d9c74f1caec1ec1ae828a7f92a3ebe (diff)
downloadgcc-7a1eab9a80fa1536416212d23e43710d174e4ef7.tar.gz
/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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126873 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog12
-rw-r--r--gcc/cp/decl.c4
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/g++.dg/init/new22.C3
-rw-r--r--gcc/testsuite/g++.dg/template/crash67.C3
6 files changed, 31 insertions, 3 deletions
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 <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
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, "%<operator new%> must not return NULL unless it is "
"declared %<throw()%> (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 <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):
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<int N, int N> struct A; // { dg-error "redefinition|declared" }