aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/name-lookup.c
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@redhat.com>2011-03-08 15:38:30 +0000
committerDodji Seketeli <dodji@gcc.gnu.org>2011-03-08 16:38:30 +0100
commit9ca6556ebc27ab5f8dcd4cbb1354047aa2f81173 (patch)
tree17e43344745b397a3dc75f4a2c639f89d10cf21c /gcc/cp/name-lookup.c
parent1c2bbb161e777a6f2dc45f152e7f75c60b0fe39e (diff)
downloadgcc-9ca6556ebc27ab5f8dcd4cbb1354047aa2f81173.zip
gcc-9ca6556ebc27ab5f8dcd4cbb1354047aa2f81173.tar.gz
gcc-9ca6556ebc27ab5f8dcd4cbb1354047aa2f81173.tar.bz2
re PR c++/47957 (Type mismatch when a class derived a same name with template parameter)
PR c++/47957 gcc/cp/ * name-lookup.c (binding_to_template_parms_of_scope_p): Only consider scopes of primary template definitions. Adjust comments. gcc/testsuite/ * g++.dg/lookup/template3.C: New test. From-SVN: r170779
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r--gcc/cp/name-lookup.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 4117202..18e3441 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -4205,8 +4205,13 @@ qualified_lookup_using_namespace (tree name, tree scope,
}
/* Subroutine of outer_binding.
- Returns TRUE if BINDING is a binding to a template parameter of SCOPE,
- FALSE otherwise. */
+
+ Returns TRUE if BINDING is a binding to a template parameter of
+ SCOPE. In that case SCOPE is the scope of a primary template
+ parameter -- in the sense of G++, i.e, a template that has its own
+ template header.
+
+ Returns FALSE otherwise. */
static bool
binding_to_template_parms_of_scope_p (cxx_binding *binding,
@@ -4222,6 +4227,8 @@ binding_to_template_parms_of_scope_p (cxx_binding *binding,
return (scope
&& scope->this_entity
&& get_template_info (scope->this_entity)
+ && PRIMARY_TEMPLATE_P (TI_TEMPLATE
+ (get_template_info (scope->this_entity)))
&& parameter_of_template_p (binding_value,
TI_TEMPLATE (get_template_info \
(scope->this_entity))));