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
This commit is contained in:
parent
264fd1424e
commit
a0a6a8c966
@ -1,5 +1,8 @@
|
||||
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
|
||||
* pt.c (copy_template_args): New.
|
||||
(tsubst_pack_expansion): Use it.
|
||||
|
@ -17103,8 +17103,6 @@ tsubst_copy_and_build (tree t,
|
||||
else
|
||||
gcc_unreachable ();
|
||||
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
|
||||
&& LAMBDA_EXPR_PENDING_PROXIES (t) == NULL);
|
||||
@ -17115,6 +17113,9 @@ tsubst_copy_and_build (tree t,
|
||||
declaration of the op() for later calls to lambda_function. */
|
||||
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;
|
||||
|
||||
insert_pending_capture_proxies ();
|
||||
|
12
gcc/testsuite/g++.dg/cpp1y/lambda-generic-trailing1.C
Normal file
12
gcc/testsuite/g++.dg/cpp1y/lambda-generic-trailing1.C
Normal file
@ -0,0 +1,12 @@
|
||||
// { dg-do compile { target c++14 } }
|
||||
|
||||
template <class T>
|
||||
void f()
|
||||
{
|
||||
auto lam = [](auto a)->decltype(++a) { return a; };
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
f<int>();
|
||||
}
|
Loading…
Reference in New Issue
Block a user