Commit 6131102c by Nathan Sidwell Committed by Nathan Sidwell

re PR c++/80866 (segfault in is_overloaded_fn())

	PR c++/80866
	* parser.c (cp_parser_template_id): Keep the lookup when stashing
	the template_id.

	PR c++/80866
	* g++.dg/parse/pr80866.C: New.

From-SVN: r248377
parent 1b4b1fc7
2017-05-23 Nathan Sidwell <nathan@acm.org> 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. * cp-tree.h (DECL_HIDDEN_P): New.
* name-lookup.c (set_decl_context, * name-lookup.c (set_decl_context,
set_local_extern_decl_linkage): New, broken out of ... set_local_extern_decl_linkage): New, broken out of ...
......
...@@ -15570,6 +15570,11 @@ cp_parser_template_id (cp_parser *parser, ...@@ -15570,6 +15570,11 @@ cp_parser_template_id (cp_parser *parser,
= make_location (token->location, token->location, finish_loc); = make_location (token->location, token->location, finish_loc);
token->location = combined_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 /* Retrieve any deferred checks. Do not pop this access checks yet
so the memory will not be reclaimed during token replacing below. */ so the memory will not be reclaimed during token replacing below. */
token->u.tree_check_value = ggc_cleared_alloc<struct tree_check> (); 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> 2017-05-23 Jan Hubicka <hubicka@ucw.cz>
* gcc.dg/ipa/ctor-empty-1.c: Update template. * gcc.dg/ipa/ctor-empty-1.c: Update template.
......
// { 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();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment