summaryrefslogtreecommitdiff
path: root/gcc/cp/lambda.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-31 15:10:41 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2017-01-31 15:10:41 +0000
commit3ac2178bf186494a360c88c130427486a4803551 (patch)
tree3d604b4184e9611d9c196a1136cc32ae6be34e40 /gcc/cp/lambda.c
parentc2c0951d11865d2343fabdadafcd61615d8f84f5 (diff)
downloadgcc-3ac2178bf186494a360c88c130427486a4803551.tar.gz
PR c++/79264
* lambda.c (maybe_generic_this_capture): Deal with template-id-exprs. * semantics.c (finish_member_declaration): Assert class is being defined. PR c++/79264 * g++.dg/cpp1y/pr61636-1.C: Augment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@245065 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/lambda.c')
-rw-r--r--gcc/cp/lambda.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c
index 538c8063957..46ab30f0a76 100644
--- a/gcc/cp/lambda.c
+++ b/gcc/cp/lambda.c
@@ -849,13 +849,21 @@ maybe_generic_this_capture (tree object, tree fns)
interest. */
if (BASELINK_P (fns))
fns = BASELINK_FUNCTIONS (fns);
+ bool id_expr = TREE_CODE (fns) == TEMPLATE_ID_EXPR;
+ if (id_expr)
+ fns = TREE_OPERAND (fns, 0);
for (; fns; fns = OVL_NEXT (fns))
- if (DECL_NONSTATIC_MEMBER_FUNCTION_P (OVL_CURRENT (fns)))
- {
- /* Found a non-static member. Capture this. */
- lambda_expr_this_capture (lam, true);
- break;
- }
+ {
+ tree fn = OVL_CURRENT (fns);
+
+ if ((!id_expr || TREE_CODE (fn) == TEMPLATE_DECL)
+ && DECL_NONSTATIC_MEMBER_FUNCTION_P (fn))
+ {
+ /* Found a non-static member. Capture this. */
+ lambda_expr_this_capture (lam, true);
+ break;
+ }
+ }
}
}