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
This commit is contained in:
Jason Merrill 2017-04-09 01:06:08 -04:00 committed by Jason Merrill
parent 310ce882d9
commit c60faeee9e
3 changed files with 19 additions and 1 deletions

View File

@ -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

View File

@ -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);

View File

@ -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>(); }