Commit a0a6a8c9 by Jason Merrill Committed by Jason Merrill

pt.c (tsubst_copy_and_build): Get LAMBDA_EXPR_RETURN_TYPE from the instantiated closure.

	* pt.c (tsubst_copy_and_build) [LAMBDA_EXPR]: Get
	LAMBDA_EXPR_RETURN_TYPE from the instantiated closure.

From-SVN: r233955
parent 264fd142
2016-03-03 Jason Merrill <jason@redhat.com> 2016-03-03 Jason Merrill <jason@redhat.com>
* pt.c (tsubst_copy_and_build) [LAMBDA_EXPR]: Get
LAMBDA_EXPR_RETURN_TYPE from the instantiated closure.
PR c++/67164 PR c++/67164
* pt.c (copy_template_args): New. * pt.c (copy_template_args): New.
(tsubst_pack_expansion): Use it. (tsubst_pack_expansion): Use it.
......
...@@ -17103,8 +17103,6 @@ tsubst_copy_and_build (tree t, ...@@ -17103,8 +17103,6 @@ tsubst_copy_and_build (tree t,
else else
gcc_unreachable (); gcc_unreachable ();
LAMBDA_EXPR_EXTRA_SCOPE (r) = scope; LAMBDA_EXPR_EXTRA_SCOPE (r) = scope;
LAMBDA_EXPR_RETURN_TYPE (r)
= tsubst (LAMBDA_EXPR_RETURN_TYPE (t), args, complain, in_decl);
gcc_assert (LAMBDA_EXPR_THIS_CAPTURE (t) == NULL_TREE gcc_assert (LAMBDA_EXPR_THIS_CAPTURE (t) == NULL_TREE
&& LAMBDA_EXPR_PENDING_PROXIES (t) == NULL); && LAMBDA_EXPR_PENDING_PROXIES (t) == NULL);
...@@ -17115,6 +17113,9 @@ tsubst_copy_and_build (tree t, ...@@ -17115,6 +17113,9 @@ tsubst_copy_and_build (tree t,
declaration of the op() for later calls to lambda_function. */ declaration of the op() for later calls to lambda_function. */
complete_type (type); complete_type (type);
if (tree fn = lambda_function (type))
LAMBDA_EXPR_RETURN_TYPE (r) = TREE_TYPE (TREE_TYPE (fn));
LAMBDA_EXPR_THIS_CAPTURE (r) = NULL_TREE; LAMBDA_EXPR_THIS_CAPTURE (r) = NULL_TREE;
insert_pending_capture_proxies (); insert_pending_capture_proxies ();
......
// { dg-do compile { target c++14 } }
template <class T>
void f()
{
auto lam = [](auto a)->decltype(++a) { return a; };
}
int main()
{
f<int>();
}
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