aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2019-02-11 20:03:43 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2019-02-11 20:03:43 +0000
commitab97c3cdaf837637722237a4d1c33ddfdf6f7ee7 (patch)
treee4dc6f525b2c00aacd8bb33d3a9506367f841b92 /gcc/cp
parent75c5639de1dba21290c3a88c440963c3c14fa827 (diff)
downloadgcc-ab97c3cdaf837637722237a4d1c33ddfdf6f7ee7.zip
gcc-ab97c3cdaf837637722237a4d1c33ddfdf6f7ee7.tar.gz
gcc-ab97c3cdaf837637722237a4d1c33ddfdf6f7ee7.tar.bz2
PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
* pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for null member pointer value. * g++.dg/cpp0x/nullptr40.C: New test. * g++.dg/cpp0x/nullptr41.C: New test. From-SVN: r268781
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c6
2 files changed, 12 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 3bfd06f..3d3bb2a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2019-02-11 Marek Polacek <polacek@redhat.com>
+
+ PR c++/89212 - ICE converting nullptr to pointer-to-member-function.
+ * pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Return early for
+ null member pointer value.
+
2019-02-11 Jakub Jelinek <jakub@redhat.com>
PR c++/88977
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index eb17976..184cb85 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -19253,6 +19253,12 @@ tsubst_copy_and_build (tree t,
looked up by digest_init. */
process_index_p = !(type && MAYBE_CLASS_TYPE_P (type));
+ if (null_member_pointer_value_p (t))
+ {
+ gcc_assert (same_type_p (type, TREE_TYPE (t)));
+ RETURN (t);
+ }
+
n = vec_safe_copy (CONSTRUCTOR_ELTS (t));
newlen = vec_safe_length (n);
FOR_EACH_VEC_SAFE_ELT (n, idx, ce)