]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/90265 - ICE with generic lambda.
authorMarek Polacek <polacek@redhat.com>
Mon, 6 May 2019 17:08:08 +0000 (17:08 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Mon, 6 May 2019 17:08:08 +0000 (17:08 +0000)
* pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
element in the vector.

* g++.dg/cpp1y/lambda-generic-90265.C: New test.

From-SVN: r270919

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/lambda-generic-90265.C [new file with mode: 0644]

index d152763be493baa5aa57c12cc5aabea655101713..a2dc643862fdee4d75a4b09812de0ab11e12e70f 100644 (file)
@@ -1,3 +1,9 @@
+2019-05-06  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/90265 - ICE with generic lambda.
+       * pt.c (tsubst_copy_and_build): Use a dedicated variable for the last
+       element in the vector.
+
 2019-05-06  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/90173
index e682b6d51be3608dea7b3a9a4d7c54c8158b8873..f316644d430174cda052118ca68865beae48508b 100644 (file)
@@ -18881,7 +18881,8 @@ tsubst_copy_and_build (tree t,
            if (thisarg)
              {
                /* Shift the other args over to make room.  */
-               vec_safe_push (call_args, (*call_args)[nargs-1]);
+               tree last = (*call_args)[nargs - 1];
+               vec_safe_push (call_args, last);
                for (int i = nargs-1; i > 0; --i)
                  (*call_args)[i] = (*call_args)[i-1];
                (*call_args)[0] = thisarg;
index 3fb178d1d98d4427aa5dcdf236fa70d9b0075bb4..17828a3a0adba4560d939ad445c7a59eb5addfc0 100644 (file)
@@ -1,3 +1,8 @@
+2019-05-06  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/90265 - ICE with generic lambda.
+       * g++.dg/cpp1y/lambda-generic-90265.C: New test.
+
 2019-05-06  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/90173
diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-90265.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-90265.C
new file mode 100644 (file)
index 0000000..d9ab9b7
--- /dev/null
@@ -0,0 +1,4 @@
+// PR c++/90265
+// { dg-do compile { target c++14 } }
+
+void (*a)(int, int, int, void *) = [](auto, auto, auto, auto) {};