Skip to content

Commit

Permalink
PR c++/80267 - ICE with nested capture of reference
Browse files Browse the repository at this point in the history
	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
  • Loading branch information
jason committed Apr 9, 2017
1 parent cefcae7 commit 4841d4e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions gcc/cp/ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion gcc/cp/pt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 12 additions & 0 deletions gcc/testsuite/g++.dg/cpp0x/lambda/lambda-nested6.C
Original file line number Diff line number Diff line change
@@ -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>(); }

0 comments on commit 4841d4e

Please sign in to comment.