+2019-01-17 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/86610
+ * semantics.c (process_outer_var_ref): Only skip dependent types
+ in templates.
+
2019-01-17 Alexandre Oliva <aoliva@redhat.com>
PR c++/87768
}
/* In a lambda within a template, wait until instantiation
- time to implicitly capture. */
+ time to implicitly capture a dependent type. */
if (context == containing_function
- && DECL_TEMPLATE_INFO (containing_function)
- && uses_template_parms (DECL_TI_ARGS (containing_function)))
+ && dependent_type_p (TREE_TYPE (decl)))
return decl;
if (lambda_expr && VAR_P (decl)
+2019-01-17 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/86610
+ * g++.dg/cpp0x/pr86610.C: New.
+
2019-01-17 Wei Xiao <wei3.xiao@intel.com>
* gcc.target/i386/avx512f-vfixupimmpd-2.c: Fix the test cases for
--- /dev/null
+// { dg-do run { target c++11 } }
+// PR c++86610 lambda capture inside template
+
+struct C
+{
+ int operator[](int)
+ { return 1; }
+
+ int operator[](int) const
+ { return 0; } // Want this one
+};
+
+int q()
+{
+ C c;
+ return [=] { return c[0]; }();
+}
+
+template <typename T>
+int f()
+{
+ C c;
+ T d;
+ return [=] { return c[0]; }()
+ + [=] { return c[0] + d[0]; }();
+}
+
+int main()
+{
+ return q () + f<C>();
+}