aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/call.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-08-28 11:38:29 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-08-28 11:38:29 -0400
commite90abaa0a28ccc5581f5b7c7abc789c8fb84764c (patch)
tree66c53e1699feba9e99d474d7b0964f8cd338cec1 /gcc/cp/call.c
parent2aef967bc8e30972f0ddf792e6045d716078b55a (diff)
downloadgcc-e90abaa0a28ccc5581f5b7c7abc789c8fb84764c.zip
gcc-e90abaa0a28ccc5581f5b7c7abc789c8fb84764c.tar.gz
gcc-e90abaa0a28ccc5581f5b7c7abc789c8fb84764c.tar.bz2
Core DR 342 PR c++/48582
Core DR 342 PR c++/48582 * pt.c (check_valid_ptrmem_cst_expr): A null member pointer value is valid in C++11. (convert_nontype_argument): Likewise. Implicitly convert nullptr and do constant folding. * mangle.c (write_template_arg_literal): Mangle null member pointer values as 0. * call.c (null_member_pointer_value_p): New. * cp-tree.h: Declare it. From-SVN: r178144
Diffstat (limited to 'gcc/cp/call.c')
-rw-r--r--gcc/cp/call.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index dc35824..8421260 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -553,6 +553,23 @@ null_ptr_cst_p (tree t)
return false;
}
+/* Returns true iff T is a null member pointer value (4.11). */
+
+bool
+null_member_pointer_value_p (tree t)
+{
+ tree type = TREE_TYPE (t);
+ if (!type)
+ return false;
+ else if (TYPE_PTRMEMFUNC_P (type))
+ return (TREE_CODE (t) == CONSTRUCTOR
+ && integer_zerop (CONSTRUCTOR_ELT (t, 0)->value));
+ else if (TYPE_PTRMEM_P (type))
+ return integer_all_onesp (t);
+ else
+ return false;
+}
+
/* Returns nonzero if PARMLIST consists of only default parms,
ellipsis, and/or undeduced parameter packs. */