This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: simply produced namespace bug


> (Incorrect) error messages from GCC:
> simple.cpp:6: `X' does not have a nested type named `foo'
> simple.cpp:6: template class without a name


Thanks for your bug report. Here is a patch.

Regards,
Martin

1999-03-12  Martin von L÷wis  <loewis@informatik.hu-berlin.de>

	* decl.c (select_decl): Allow class templates when we need types,
	even if we don't have < as next token.
	* decl2.c (ambiguous_decl): Likewise.

// Build don't link:
namespace X {
    template <class T> class foo;
}

template <class T>
class X::foo {
    T worthless;
};

Index: decl.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl.c,v
retrieving revision 1.320
diff -u -r1.320 decl.c
--- decl.c	1999/03/09 23:02:32	1.320
+++ decl.c	1999/03/12 11:43:07
@@ -5246,7 +5246,8 @@
     val = TYPE_STUB_DECL (BINDING_TYPE (binding));
   /* Don't return non-types if we really prefer types. */
   else if (val && LOOKUP_TYPES_ONLY (flags)  && TREE_CODE (val) != TYPE_DECL
-	   && (!looking_for_template || TREE_CODE (val) != TEMPLATE_DECL))
+	   && (TREE_CODE (val) != TEMPLATE_DECL
+	       || !DECL_CLASS_TEMPLATE_P (val)))
     val = NULL_TREE;
 
   return val;
Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.190
diff -u -r1.190 decl2.c
--- decl2.c	1999/03/06 03:54:30	1.190
+++ decl2.c	1999/03/12 11:43:12
@@ -4063,8 +4063,7 @@
         /* If we expect types or namespaces, and not templates,
            or this is not a template class. */
         if (LOOKUP_QUALIFIERS_ONLY (flags)
-            && (!(flags & LOOKUP_TEMPLATES_EXPECTED)
-                || !DECL_CLASS_TEMPLATE_P (val)))
+            && !DECL_CLASS_TEMPLATE_P (val))
           val = NULL_TREE;
         break;
       case TYPE_DECL:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]