diff mbox series

[C++] Tiny lambda instantiation tweak.

Message ID 20181215220915.23180-1-jason@redhat.com
State New
Headers show
Series [C++] Tiny lambda instantiation tweak. | expand

Commit Message

Jason Merrill Dec. 15, 2018, 10:09 p.m. UTC
While looking at something else I noticed that we were passing 0 to the
"nonclass" parameter here; we might as well pass 1, since capture proxies
are always at block scope.

Tested x86_64-pc-linux-gnu, applying to trunk.

	* pt.c (tsubst_expr) [DECL_EXPR]: Ignore class-scope bindings when
	looking up a capture proxy.
---
 gcc/cp/pt.c      | 5 +++--
 gcc/cp/ChangeLog | 5 +++++
 2 files changed, 8 insertions(+), 2 deletions(-)


base-commit: 95f61091a1264856c1128b67791843a791cb415f
diff mbox series

Patch

diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 3b378ee9ff4..a5b9fa67666 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -16903,8 +16903,9 @@  tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl,
 	    tree inst;
 	    if (!DECL_PACK_P (decl))
 	      {
-		inst = lookup_name_real (DECL_NAME (decl), 0, 0,
-					 /*block_p=*/true, 0, LOOKUP_HIDDEN);
+		inst = lookup_name_real (DECL_NAME (decl), /*prefer_type*/0,
+					 /*nonclass*/1, /*block_p=*/true,
+					 /*ns_only*/0, LOOKUP_HIDDEN);
 		gcc_assert (inst != decl && is_capture_proxy (inst));
 	      }
 	    else if (is_normal_capture_proxy (decl))
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 46557bec5c2..3dfaa75cbb5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@ 
+2018-12-14  Jason Merrill  <jason@redhat.com>
+
+	* pt.c (tsubst_expr) [DECL_EXPR]: Ignore class-scope bindings when
+	looking up a capture proxy.
+
 2018-12-13  Marek Polacek  <polacek@redhat.com>
 
 	PR c++/88216 - ICE with class type in non-type template parameter.