Commit 01bfd257 by Nathan Sidwell Committed by Nathan Sidwell

re PR c++/77812 (incorrectly rejects valid C++ code that uses enum in template instantiation)

	cp/
	PR c++/77812
	* name-lookup.c (set_namespace_binding_1): An overload of 1 decl
	is a new overload.

	testsuite/
	PR c++/77812
	* g++.dg/pr77812.C: New.

From-SVN: r244335
parent 5b33cc83
2017-01-11 Nathan Sidwell <nathan@acm.org>
PR c++/77812
* name-lookup.c (set_namespace_binding_1): An overload of 1 decl
is a new overload.
2017-01-11 Nathan Sidwell <nathan@acm.org>
* name-lookup.c (push_overloaded_decl_1): Refactor OVERLOAD creation.
2017-01-11 Jakub Jelinek <jakub@redhat.com>
......
......@@ -3496,7 +3496,12 @@ set_namespace_binding_1 (tree name, tree scope, tree val)
if (scope == NULL_TREE)
scope = global_namespace;
b = binding_for_name (NAMESPACE_LEVEL (scope), name);
if (!b->value || TREE_CODE (val) == OVERLOAD || val == error_mark_node)
if (!b->value
/* For templates and using we create a single element OVERLOAD.
Look for the chain to know whether this is really augmenting
an existing overload. */
|| (TREE_CODE (val) == OVERLOAD && OVL_CHAIN (val))
|| val == error_mark_node)
b->value = val;
else
supplement_binding (b, val);
......
2017-01-11 Nathan Sidwell <nathan@acm.org>
PR c++/77812
* g++.dg/pr77812.C: New.
2017-01-11 Jakub Jelinek <jakub@redhat.com>
PR c++/71537
......
// PR77812
// struct-stat hack failure when first overload is a template
enum f {};
template <typename>
void f ()
{
}
enum f F;
struct g {};
template <typename>
void g ()
{
}
struct g G;
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