aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/lambda.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2016-01-22 15:36:30 -0500
committerJason Merrill <jason@gcc.gnu.org>2016-01-22 15:36:30 -0500
commit130ee9a9fc802926d2fe2701e041c98a6fb0f981 (patch)
tree5b05d650ef9ad80cfc1f41d5f5d143983cf0383d /gcc/cp/lambda.c
parent44b6ab2bf9597eb5f02e549d0236b942c007a1b0 (diff)
downloadgcc-130ee9a9fc802926d2fe2701e041c98a6fb0f981.zip
gcc-130ee9a9fc802926d2fe2701e041c98a6fb0f981.tar.gz
gcc-130ee9a9fc802926d2fe2701e041c98a6fb0f981.tar.bz2
re PR c++/69392 (G++ can't capture 'this' pointer to templated type using init-capture)
PR c++/69392 * lambda.c (lambda_capture_field_type): Handle 'this' specially for init-capture, too. From-SVN: r232746
Diffstat (limited to 'gcc/cp/lambda.c')
-rw-r--r--gcc/cp/lambda.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 3b0ea18..93b192c 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -207,15 +207,8 @@ tree
lambda_capture_field_type (tree expr, bool explicit_init_p)
{
tree type;
- if (explicit_init_p)
- {
- type = make_auto ();
- type = do_auto_deduction (type, expr, type);
- }
- else
- type = non_reference (unlowered_expr_type (expr));
- if (type_dependent_expression_p (expr)
- && !is_this_parameter (tree_strip_nop_conversions (expr)))
+ bool is_this = is_this_parameter (tree_strip_nop_conversions (expr));
+ if (!is_this && type_dependent_expression_p (expr))
{
type = cxx_make_type (DECLTYPE_TYPE);
DECLTYPE_TYPE_EXPR (type) = expr;
@@ -223,6 +216,13 @@ lambda_capture_field_type (tree expr, bool explicit_init_p)
DECLTYPE_FOR_INIT_CAPTURE (type) = explicit_init_p;
SET_TYPE_STRUCTURAL_EQUALITY (type);
}
+ else if (!is_this && explicit_init_p)
+ {
+ type = make_auto ();
+ type = do_auto_deduction (type, expr, type);
+ }
+ else
+ type = non_reference (unlowered_expr_type (expr));
return type;
}