* semantics.c (apply_deduced_return_type): Call
complete_type_or_else before building the new RESULT_DECL.
From-SVN: r238631
2016-07-21 Jason Merrill <jason@redhat.com>
+ PR c++/69223
+ * semantics.c (apply_deduced_return_type): Call
+ complete_type_or_else before building the new RESULT_DECL.
+
PR c++/71913
* call.c (unsafe_copy_elision_p): It's OK to elide when
initializing an unknown object.
if (TREE_TYPE (result) == return_type)
return;
+ if (!processing_template_decl && !VOID_TYPE_P (return_type)
+ && !complete_type_or_else (return_type, NULL_TREE))
+ return;
+
/* We already have a DECL_RESULT from start_preparsed_function.
Now we need to redo the work it and allocate_struct_function
did to reflect the new type. */
--- /dev/null
+// PR c++/69223
+// { dg-do compile { target c++11 } }
+
+template <class T> struct A
+{
+ T x[20];
+};
+
+int main()
+{
+ auto l = [](const A<int>& i){ return i; };
+ A<int> a;
+
+ l(a);
+}