/usr/src/gcc-6/debian/patches/pr78774.diff is in gcc-6-source 6.4.0-17ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # DP: Fix PR c++/78774, proposed for the gcc-6-branch
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.
Index: b/src/gcc/cp/pt.c
===================================================================
--- a/src/gcc/cp/pt.c
+++ b/src/gcc/cp/pt.c
@@ -7285,9 +7285,11 @@ 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
+ && TREE_CODE (innertype) == REFERENCE_TYPE
&& 0 < TREE_OPERAND_LENGTH (inner)
&& reject_gcc_builtin (TREE_OPERAND (inner, 0)))
return error_mark_node;
Index: b/src/gcc/testsuite/g++.dg/cpp1y/pr78774.C
===================================================================
--- /dev/null
+++ b/src/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 <int> struct ops {
+ template <int> struct A;
+ template <int *Ptr> using explode = typename A<*Ptr>::join;
+};
+template <typename Ts> typename ops<'\0'>::explode<Ts::join>::type a;
|