From d5fe39d47c336e55acb80aa08e24e307e9262a83 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 19 Feb 2019 09:43:23 +0100 Subject: [PATCH] re PR c++/89387 (ICE in maybe_generic_this_capture at gcc/cp/lambda.c:945 since r268851) PR c++/89387 * lambda.c (maybe_generic_this_capture): Don't check DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs. * g++.dg/cpp0x/lambda/lambda-89387.C: New test. From-SVN: r269009 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/lambda.c | 3 ++- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/g++.dg/cpp0x/lambda/lambda-89387.C | 11 +++++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/lambda/lambda-89387.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1398d48392f..2373c98b618 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,9 @@ 2019-02-19 Jakub Jelinek + PR c++/89387 + * lambda.c (maybe_generic_this_capture): Don't check + DECL_NONSTATIC_MEMBER_FUNCTION_P on USING_DECLs. + PR c++/89391 * typeck.c (build_reinterpret_cast_1): Don't handle void to && conversion go through build_target_expr_with_type. diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index 2290fe0efee..791c8de6738 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -941,7 +941,8 @@ maybe_generic_this_capture (tree object, tree fns) fns = TREE_OPERAND (fns, 0); for (lkp_iterator iter (fns); iter; ++iter) - if ((!id_expr || TREE_CODE (*iter) == TEMPLATE_DECL) + if (((!id_expr && TREE_CODE (*iter) != USING_DECL) + || TREE_CODE (*iter) == TEMPLATE_DECL) && DECL_NONSTATIC_MEMBER_FUNCTION_P (*iter)) { /* Found a non-static member. Capture this. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 925e82e1625..c6387503b40 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-02-19 Jakub Jelinek + PR c++/89387 + * g++.dg/cpp0x/lambda/lambda-89387.C: New test. + PR c++/89391 * g++.dg/cpp0x/reinterpret_cast2.C: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-89387.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-89387.C new file mode 100644 index 00000000000..943ebc94373 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-89387.C @@ -0,0 +1,11 @@ +// PR c++/89387 +// { dg-do compile { target c++11 } } + +template