commit 7082532a480501ab8f8f99bc62589a9045da303a
Author: Jason Merrill <jason@redhat.com>
Date: Tue Aug 30 10:38:52 2011 -0400
PR c++/50220
* semantics.c (add_capture): Call complete_type for copy.
@@ -8651,6 +8651,9 @@ add_capture (tree lambda, tree id, tree initializer, bool by_reference_p,
if (!real_lvalue_p (initializer))
error ("cannot capture %qE by reference", initializer);
}
+ else
+ /* Capture by copy requires a complete type. */
+ type = complete_type (type);
/* Add __ to the beginning of the field name so that user code
won't find the field with name lookup. We can't just leave the name
new file mode 100644
@@ -0,0 +1,9 @@
+// PR c++/50220
+// { dg-options -std=c++0x }
+
+template<typename Foo> struct Foobar {};
+
+void foobar(const Foobar<void>& obj)
+{
+ [obj](){}();
+}