diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2006-08-25 16:56:07 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2006-08-25 16:56:07 +0000 |
commit | 7d3bec9db50a2d46f697ad621edd50165e51c168 (patch) | |
tree | 1975a26da88ae00800dc1b09ba8808327325e61d /gcc/cp/decl2.c | |
parent | 9eb8a531c0127cff8323c43fc9b148e585cd9288 (diff) | |
download | gcc-7d3bec9db50a2d46f697ad621edd50165e51c168.zip gcc-7d3bec9db50a2d46f697ad621edd50165e51c168.tar.gz gcc-7d3bec9db50a2d46f697ad621edd50165e51c168.tar.bz2 |
re PR c++/27787 (Qualified lookup fails to find inherited class template)
cp/
PR c++/27787
* decl.c (make_typename_type): Only try and resolve it when
context is not dependent. Refactor.
* decl2.c (check_classfn): Push to class scope before looking for
the function.
testsuite/
PR c++/27787
* g++.dg/template/typename10.C: New.
* g++.dg/template/lookup4.C: Remove bogus error marker.
From-SVN: r116409
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 0de2756..db1e917 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -553,7 +553,8 @@ check_classfn (tree ctype, tree function, tree template_parms) { int ix; bool is_template; - + tree pushed_scope; + if (DECL_USE_TEMPLATE (function) && !(TREE_CODE (function) == TEMPLATE_DECL && DECL_TEMPLATE_SPECIALIZATION (function)) @@ -583,16 +584,18 @@ check_classfn (tree ctype, tree function, tree template_parms) /* OK, is this a definition of a member template? */ is_template = (template_parms != NULL_TREE); + /* We must enter the scope here, because conversion operators are + named by target type, and type equivalence relies on typenames + resolving within the scope of CTYPE. */ + pushed_scope = push_scope (ctype); ix = class_method_index_for_fn (complete_type (ctype), function); if (ix >= 0) { VEC(tree,gc) *methods = CLASSTYPE_METHOD_VEC (ctype); tree fndecls, fndecl = 0; bool is_conv_op; - tree pushed_scope; const char *format = NULL; - pushed_scope = push_scope (ctype); for (fndecls = VEC_index (tree, methods, ix); fndecls; fndecls = OVL_NEXT (fndecls)) { @@ -631,10 +634,13 @@ check_classfn (tree ctype, tree function, tree template_parms) == DECL_TI_TEMPLATE (fndecl)))) break; } - if (pushed_scope) - pop_scope (pushed_scope); if (fndecls) - return OVL_CURRENT (fndecls); + { + if (pushed_scope) + pop_scope (pushed_scope); + return OVL_CURRENT (fndecls); + } + error ("prototype for %q#D does not match any in class %qT", function, ctype); is_conv_op = DECL_CONV_FN_P (fndecl); @@ -682,6 +688,9 @@ check_classfn (tree ctype, tree function, tree template_parms) properly within the class. */ if (COMPLETE_TYPE_P (ctype)) add_method (ctype, function, NULL_TREE); + + if (pushed_scope) + pop_scope (pushed_scope); return NULL_TREE; } |