/usr/src/gcc-7/debian/patches/pr83204.diff is in gcc-7-source 7.3.0-16ubuntu3.
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | # DP: Fix PR c++/83204, taken from the trunk
gcc/cp/
2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/83204
* pt.c (tsubst_copy_and_build): Use force_paren_expr for INDIRECT_REF.
gcc/testsuite/
2018-02-08 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/83204
* g++.dg/cpp0x/lambda/lambda-ice25.C: New.
Index: b/src/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice25.C
===================================================================
--- /dev/null
+++ b/src/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice25.C
@@ -0,0 +1,27 @@
+// PR c++/83204
+// { dg-do compile { target c++11 } }
+
+int rand();
+
+template<typename T>
+struct s
+{
+ int count() { return rand(); }
+};
+
+template<typename v>
+void f(s<v> a)
+{
+ int const x = a.count();
+ int r = 0;
+ auto l = [&](int& r)
+ {
+ for(int y = 0, yend = (x); y < yend; ++y)
+ {
+ r += y;
+ }
+ };
+ l(r);
+}
+
+template void f(s<float>);
Index: b/src/gcc/cp/pt.c
===================================================================
--- a/src/gcc/cp/pt.c
+++ b/src/gcc/cp/pt.c
@@ -16810,8 +16810,8 @@ tsubst_copy_and_build (tree t,
r = build_x_indirect_ref (input_location, r, RO_UNARY_STAR,
complain|decltype_flag);
- if (TREE_CODE (r) == INDIRECT_REF)
- REF_PARENTHESIZED_P (r) = REF_PARENTHESIZED_P (t);
+ if (REF_PARENTHESIZED_P (t))
+ r = force_paren_expr (r);
RETURN (r);
}
|