diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 60b514b389c1..d2e8d456023d 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 a45e99cc5965..a21be812bafa 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 bdee8fd3e1fc..88665a2c6a82 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 000000000000..c77032ddbad4 --- /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;