re PR c++/89387 (ICE in maybe_generic_this_capture at gcc/cp/lambda.c:945 since r268851)
authorJakub Jelinek <jakub@redhat.com>
Tue, 19 Feb 2019 08:43:23 +0000 (09:43 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 19 Feb 2019 08:43:23 +0000 (09:43 +0100)
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
gcc/cp/lambda.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-89387.C [new file with mode: 0644]

index 1398d48392f464aa0d889e7c63d655e7e83e1057..2373c98b618083264d7d3fa8167697b9592f0ce7 100644 (file)
@@ -1,5 +1,9 @@
 2019-02-19  Jakub Jelinek  <jakub@redhat.com>
 
+       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.
index 2290fe0efeec70ef251bc7a44f70be54233af1e6..791c8de6738075681ff0566e6e01531eaf768544 100644 (file)
@@ -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.  */
index 925e82e1625393c676e1b0c66180df93038a63e3..c6387503b401ab58c6a4e5036355eb66b72dbc45 100644 (file)
@@ -1,5 +1,8 @@
 2019-02-19  Jakub Jelinek  <jakub@redhat.com>
 
+       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 (file)
index 0000000..943ebc9
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/89387
+// { dg-do compile { target c++11 } }
+
+template <template <typename, typename> class T>
+struct S {
+  using A = int;
+  using B = T<unsigned, A>;
+  using B::foo;
+  void bar () { [&] { foo (); }; }
+  void foo ();
+};