From: Martin Sebor Date: Thu, 15 Dec 2016 03:08:14 +0000 (+0000) Subject: PR c++/78774 - [6/7 Regression] ICE in constexpr string literals and templates X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1750f2a55a7f17c557fa591691a15c363181fa80;p=gcc.git PR c++/78774 - [6/7 Regression] ICE in constexpr string literals and templates gcc/cp/ChangeLog: PR c++/78774 * pt.c (convert_template_argument): Avoid assuming operand type is non-null since that of SCOPE_REF is not. gcc/testsuite/ChangeLog: PR c++/78774 * g++.dg/cpp1y/pr78774.C: New test. From-SVN: r243683 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 60b514b389c..d2e8d456023 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2016-12-14 Martin Sebor + + PR c++/78774 + * pt.c (convert_template_argument): Avoid assuming operand type + is non-null since that of SCOPE_REF is not. + 2016-12-14 Martin Jambor * parser.c: Include omp-general.h and omp-offload.h instead of diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index a45e99cc596..a21be812baf 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -7379,9 +7379,10 @@ convert_template_argument (tree parm, /* Reject template arguments that are references to built-in functions with no library fallbacks. */ const_tree inner = TREE_OPERAND (val, 0); - if (TREE_CODE (TREE_TYPE (inner)) == REFERENCE_TYPE - && TREE_CODE (TREE_TYPE (TREE_TYPE (inner))) == FUNCTION_TYPE - && TREE_CODE (TREE_TYPE (inner)) == REFERENCE_TYPE + const_tree innertype = TREE_TYPE (inner); + if (innertype + && TREE_CODE (innertype) == REFERENCE_TYPE + && TREE_CODE (TREE_TYPE (innertype)) == FUNCTION_TYPE && 0 < TREE_OPERAND_LENGTH (inner) && reject_gcc_builtin (TREE_OPERAND (inner, 0))) return error_mark_node; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bdee8fd3e1f..88665a2c6a8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-12-14 Martin Sebor + + PR c++/78774 + * g++.dg/cpp1y/pr78774.C: New test. + 2016-12-14 David Malcolm PR target/78213 diff --git a/gcc/testsuite/g++.dg/cpp1y/pr78774.C b/gcc/testsuite/g++.dg/cpp1y/pr78774.C new file mode 100644 index 00000000000..c77032ddbad --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/pr78774.C @@ -0,0 +1,9 @@ +// PR c++/78774 - [6/7 Regression] ICE in constexpr string literals and +// templates +// { dg-do compile { target c++14 } } + +template struct ops { + template struct A; + template using explode = typename A<*Ptr>::join; +}; +template typename ops<'\0'>::explode::type a;