]> gcc.gnu.org Git - gcc.git/commitdiff
pt.c (lookup_template_class): Use currently_open_class, compare template args later.
authorJason Merrill <jason@redhat.com>
Wed, 24 Jun 2009 18:47:36 +0000 (14:47 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 24 Jun 2009 18:47:36 +0000 (14:47 -0400)
* pt.c (lookup_template_class): Use currently_open_class,
compare template args later.

From-SVN: r148915

gcc/cp/ChangeLog
gcc/cp/pt.c

index de3828e116308e94eaca3797c06f9e134e4d0ab1..2a6ec5d6527d2810cd3945b839302f1801fe3831 100644 (file)
@@ -1,5 +1,8 @@
 2009-06-24  Jason Merrill  <jason@redhat.com>
 
+       * pt.c (lookup_template_class): Use currently_open_class,
+       compare template args later.
+
        PR c++/40342
        * decl.c (decls_match): Check DECL_TI_TEMPLATE too.
        * class.c (resolve_address_of_overloaded_function): Fix typo.
index 977a10118714c84a3441ef9d31796f7bbba19516..e0a413bfb28da164dbc4ba3eebbb3db71be23558 100644 (file)
@@ -5845,31 +5845,13 @@ lookup_template_class (tree d1,
 
         the `C<T>' is just the same as `C'.  Outside of the
         class, however, such a reference is an instantiation.  */
-      if (comp_template_args (TYPE_TI_ARGS (template_type),
-                             arglist))
-       {
-         found = template_type;
-
-         if (!entering_scope && PRIMARY_TEMPLATE_P (templ))
-           {
-             tree ctx;
-
-             for (ctx = current_class_type;
-                  ctx && TREE_CODE (ctx) != NAMESPACE_DECL;
-                  ctx = (TYPE_P (ctx)
-                         ? TYPE_CONTEXT (ctx)
-                         : DECL_CONTEXT (ctx)))
-               if (TYPE_P (ctx) && same_type_p (ctx, template_type))
-                 goto found_ctx;
-
-             /* We're not in the scope of the class, so the
-                TEMPLATE_TYPE is not the type we want after all.  */
-             found = NULL_TREE;
-           found_ctx:;
-           }
-       }
-      if (found)
-       POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, found);
+      if ((entering_scope
+          || !PRIMARY_TEMPLATE_P (templ)
+          || currently_open_class (template_type))
+         /* comp_template_args is expensive, check it last.  */
+         && comp_template_args (TYPE_TI_ARGS (template_type),
+                                arglist))
+       POP_TIMEVAR_AND_RETURN (TV_NAME_LOOKUP, template_type);
 
       /* If we already have this specialization, return it.  */
       found = retrieve_specialization (templ, arglist,
This page took 0.093942 seconds and 5 git commands to generate.