From: Nathan Sidwell Date: Tue, 23 Jan 2018 14:08:11 +0000 (+0000) Subject: [PR c++/839888] Baselink tsubst ICE X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=66ce8ff7603b3b717fff93d706b1cf3548ba4671;p=gcc.git [PR c++/839888] Baselink tsubst ICE https://gcc.gnu.org/ml/gcc-patches/2018-01/msg01954.html PR c++/83988 * pt.c (tsubst_baselink): Remove optype assert. * ptree.c (cxx_print_xnode): Print BASELINK_OPTYPE. PR c++/83988 * g++.dg/template/pr83988.C: New. From-SVN: r256986 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5adf93075d5..97c54ac9a00 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2018-01-23 Nathan Sidwell + + PR c++/83988 + * pt.c (tsubst_baselink): Remove optype assert. + * ptree.c (cxx_print_xnode): Print BASELINK_OPTYPE. + 2018-01-23 Jakub Jelinek PR c++/83958 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 0296845a31b..695870da32c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14447,11 +14447,8 @@ tsubst_baselink (tree baselink, tree object_type, fns = BASELINK_FUNCTIONS (baselink); } else - { - gcc_assert (optype == BASELINK_OPTYPE (baselink)); - /* We're going to overwrite pieces below, make a duplicate. */ - baselink = copy_node (baselink); - } + /* We're going to overwrite pieces below, make a duplicate. */ + baselink = copy_node (baselink); /* If lookup found a single function, mark it as used at this point. (If lookup found multiple functions the one selected later by diff --git a/gcc/cp/ptree.c b/gcc/cp/ptree.c index 8e7697a012d..40535c7c06a 100644 --- a/gcc/cp/ptree.c +++ b/gcc/cp/ptree.c @@ -215,6 +215,7 @@ cxx_print_xnode (FILE *file, tree node, int indent) print_node (file, "binfo", BASELINK_BINFO (node), indent + 4); print_node (file, "access_binfo", BASELINK_ACCESS_BINFO (node), indent + 4); + print_node (file, "optype", BASELINK_OPTYPE (node), indent + 4); break; case OVERLOAD: print_node (file, "function", OVL_FUNCTION (node), indent+4); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5c1d57f7ed2..17399f97a80 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-01-23 Nathan Sidwell + + PR c++/83988 + * g++.dg/template/pr83988.C: New. + 2018-01-23 Jakub Jelinek PR c++/82882 diff --git a/gcc/testsuite/g++.dg/template/pr83988.C b/gcc/testsuite/g++.dg/template/pr83988.C new file mode 100644 index 00000000000..bd2762cd68f --- /dev/null +++ b/gcc/testsuite/g++.dg/template/pr83988.C @@ -0,0 +1,16 @@ +// PR 83988 ICE + +template struct optional {}; +struct get_from_json { + template + operator optional() const {return optional ();} + template + optional maybe() const + { + return this->operator optional(); + } +}; +void test() +{ + get_from_json().maybe(); +}