2017-05-23 Nathan Sidwell <nathan@acm.org>
+ PR c++/80866
+ * parser.c (cp_parser_template_id): Keep the lookup when stashing
+ the template_id.
+
* cp-tree.h (DECL_HIDDEN_P): New.
* name-lookup.c (set_decl_context,
set_local_extern_decl_linkage): New, broken out of ...
= make_location (token->location, token->location, finish_loc);
token->location = combined_loc;
+ /* We must mark the lookup as kept, so we don't throw it away on
+ the first parse. */
+ if (is_overloaded_fn (template_id))
+ lookup_keep (get_fns (template_id), true);
+
/* Retrieve any deferred checks. Do not pop this access checks yet
so the memory will not be reclaimed during token replacing below. */
token->u.tree_check_value = ggc_cleared_alloc<struct tree_check> ();
+2017-05-23 Nathan Sidwell <nathan@acm.org>
+
+ PR c++/80866
+ * g++.dg/parse/pr80866.C: New.
+
2017-05-23 Jan Hubicka <hubicka@ucw.cz>
* gcc.dg/ipa/ctor-empty-1.c: Update template.
--- /dev/null
+// { dg-do compile { target c++11 } }
+// PR 80866 recycled a lookup too soon.
+
+void pow();
+namespace math {
+ template <typename T> void pow(T);
+}
+using namespace math;
+
+decltype(pow<>(0)) z();