summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2017-04-09 05:06:08 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2017-04-09 05:06:08 +0000
commit4841d4ef4b0019599b8f3c48cb259fa40923b6b8 (patch)
tree5645eac2b28626e998aa41bd1dfa29cc235c8c22
parentcefcae78d80f7e28becfb5d5c5be67b65ebbabb0 (diff)
downloadgcc-4841d4ef4b0019599b8f3c48cb259fa40923b6b8.tar.gz
PR c++/80267 - ICE with nested capture of reference
PR c++/60992 * pt.c (tsubst_copy): Handle lookup finding a capture proxy. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@246793 138bc75d-0d04-0410-961f-82ee72b054a4
-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 a31d114374f..e980456918e 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 f9f4921a11a..2d1e81fffd1 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 00000000000..58dfe3c908f
--- /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>(); }