This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
C++: template in namespace
- To: benko at sztaki dot hu
- Subject: C++: template in namespace
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Sun, 8 Aug 1999 12:04:22 +0200
- CC: gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- References: <3405-Mon02Aug1999140432+0200-benko@lutra.sztaki.hu>
> The non-template version compiles. This version compiles and runs
> correctly on older versions (egcs-1.1.2).
Thanks for your bug report. A patch is included below.
This patch removes a false error from gcc 2.95; ok to apply to both
branches?
1999-08-08 Martin v. Loewis <martin@mira.isdn.cs.tu-berlin.de>
* decl2.c (set_decl_namespace): Do not complain about non-matching
decls if processing a template.
Index: decl2.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/decl2.c,v
retrieving revision 1.229
diff -u -p -r1.229 decl2.c
--- decl2.c 1999/08/07 22:28:50 1.229
+++ decl2.c 1999/08/08 09:04:08
@@ -4498,6 +4498,10 @@ set_decl_namespace (decl, scope, friendp
/* Since decl is a function, old should contain a function decl. */
if (!is_overloaded_fn (old))
goto complain;
+ if (processing_template_decl || processing_specialization)
+ /* We have not reduced the fndef to template_def, yet, so
+ the decls don't match. */
+ return;
for (; old; old = OVL_NEXT (old))
if (decls_match (decl, OVL_CURRENT (old)))
return;