aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2017-04-09 01:06:08 -0400
committerJason Merrill <jason@gcc.gnu.org>2017-04-09 01:06:08 -0400
commitc60faeee9ecff24636380d2d58b7712cdfb2531f (patch)
tree5645eac2b28626e998aa41bd1dfa29cc235c8c22 /gcc
parent310ce882d9e170c6adb7f9c2ceac10959e99d1c7 (diff)
downloadgcc-c60faeee9ecff24636380d2d58b7712cdfb2531f.zip
gcc-c60faeee9ecff24636380d2d58b7712cdfb2531f.tar.gz
gcc-c60faeee9ecff24636380d2d58b7712cdfb2531f.tar.bz2
PR c++/80267 - ICE with nested capture of reference
PR c++/60992 * pt.c (tsubst_copy): Handle lookup finding a capture proxy. From-SVN: r246793
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/pt.c2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested6.C12
3 files changed, 19 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a31d114..e980456 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-07 Jason Merrill <jason@redhat.com>
+
+ PR c++/80267 - ICE with nested capture of reference
+ PR c++/60992
+ * pt.c (tsubst_copy): Handle lookup finding a capture proxy.
+
2017-04-07 Marek Polacek <polacek@redhat.com>
PR sanitizer/80348
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index f9f4921..2d1e81f 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -14566,7 +14566,7 @@ tsubst_copy (tree t, tree args, tsubst_flags_t complain, tree in_decl)
{
/* First try name lookup to find the instantiation. */
r = lookup_name (DECL_NAME (t));
- if (r)
+ if (r && !is_capture_proxy (r))
{
/* Make sure that the one we found is the one we want. */
tree ctx = DECL_CONTEXT (t);
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested6.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested6.C
new file mode 100644
index 0000000..58dfe3c
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested6.C
@@ -0,0 +1,12 @@
+// PR c++/80267
+// { dg-do compile { target c++11 } }
+
+template <typename> void a() {
+ int b;
+ auto &c = b;
+ [&] {
+ c;
+ [&] { c; };
+ };
+}
+void d() { a<int>(); }