Commit a728a2ad by Jason Merrill Committed by Jason Merrill

re PR c++/50220 ([C++0x] [4.7 Regression] ICE when capturing a by-reference…

re PR c++/50220 ([C++0x] [4.7 Regression] ICE when capturing a by-reference template function argument in a lambda)

	PR c++/50220
	* semantics.c (add_capture): Call complete_type for copy.

From-SVN: r178326
parent d05da2b9
2011-08-30 Jason Merrill <jason@redhat.com> 2011-08-30 Jason Merrill <jason@redhat.com>
PR c++/50220
* semantics.c (add_capture): Call complete_type for copy.
PR c++/50234 PR c++/50234
* semantics.c (cxx_eval_component_reference): Handle * semantics.c (cxx_eval_component_reference): Handle
value-initialization for omitted initializers. value-initialization for omitted initializers.
......
...@@ -8651,6 +8651,9 @@ add_capture (tree lambda, tree id, tree initializer, bool by_reference_p, ...@@ -8651,6 +8651,9 @@ add_capture (tree lambda, tree id, tree initializer, bool by_reference_p,
if (!real_lvalue_p (initializer)) if (!real_lvalue_p (initializer))
error ("cannot capture %qE by reference", 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 /* 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 won't find the field with name lookup. We can't just leave the name
......
2011-08-30 Jason Merrill <jason@redhat.com> 2011-08-30 Jason Merrill <jason@redhat.com>
PR c++/50220
* g++.dg/cpp0x/lambda/lambda-50220.C: New.
PR c++/50234 PR c++/50234
* g++.dg/cpp0x/constexpr-value3.C: New. * g++.dg/cpp0x/constexpr-value3.C: New.
......
// PR c++/50220
// { dg-options -std=c++0x }
template<typename Foo> struct Foobar {};
void foobar(const Foobar<void>& obj)
{
[obj](){}();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment