From 5575ae2daa739969ccf8ffb03d0f9ed48240c71a Mon Sep 17 00:00:00 2001 From: mmitchel Date: Mon, 2 Aug 2004 01:58:52 +0000 Subject: PR c++/16338 * cp-tree.h (DECL_INTEGRAL_CONSTANT_VAR_P): New macro. * call.c (null_ptr_cst_p): Handle variables with constant initializers. * pt.c (convert_nontype_argument): Use DECL_INTEGRAL_CONSTANT_VAR_P. * semantics.c (finish_id_expression): Likewise. PR c++~/16489 * decl.c (duplicate_decls): Reject duplicate namespace declarations. PR c++/16810 * typeck.c (build_ptrmemfunc): Loosen assertion. PR c++/16338 * g++.dg/init/null1.C: New test. * g++.dg/tc1/dr76.C: Adjust error marker. PR c++/16489 * g++.dg/parse/namespace10.C: New test. PR c++/16810 * g++.dg/inherit/ptrmem2.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@85421 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/cp/call.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gcc/cp/call.c') diff --git a/gcc/cp/call.c b/gcc/cp/call.c index a6bfc729352..a34eb271001 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -429,6 +429,9 @@ struct z_candidate { z_candidate *next; }; +/* Returns true iff T is a null pointer constant in the sense of + [conv.ptr]. */ + bool null_ptr_cst_p (tree t) { @@ -436,13 +439,14 @@ null_ptr_cst_p (tree t) A null pointer constant is an integral constant expression (_expr.const_) rvalue of integer type that evaluates to zero. */ + if (DECL_INTEGRAL_CONSTANT_VAR_P (t)) + t = decl_constant_value (t); if (t == null_node || (CP_INTEGRAL_TYPE_P (TREE_TYPE (t)) && integer_zerop (t))) return true; return false; } - /* Returns nonzero if PARMLIST consists of only default parms and/or ellipsis. */ -- cgit v1.2.1