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]

C++ PATCH: Fix PR 692



We should allow explicit template instantiations in any namespace.

Tested on i686-pc-linux-gnu, committed on the mainline.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2001-02-19  Mark Mitchell  <mark@codesourcery.com>

	* decl2.c (set_decl_namespace): Allow explicit instantiations in
	any namespace.

Index: cp/ChangeLog
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/ChangeLog,v
retrieving revision 1.2256
diff -c -p -r1.2256 ChangeLog
*** ChangeLog	2001/02/18 20:41:10	1.2256
--- ChangeLog	2001/02/19 21:44:13
***************
*** 62,72 ****
  	* init.c (build_new): Allow enumeration types for the array-bounds
  	in a direct-new-declarator.
  
- 	* semantics.c (finish_typeof): Resolve OFFSET_REFs.
- 
- 	* pt.c (check_explicit_specialization): Copy TREE_PRIVATE and
- 	TREE_PROTECTED from the template being specialized.
- 
  2001-02-17  Jason Merrill  <jason@redhat.com>
  
  	* decl2.c (build_artificial_parm): Set TREE_READONLY.
--- 62,67 ----
Index: cp/decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.442
diff -c -p -r1.442 decl2.c
*** decl2.c	2001/02/18 20:31:43	1.442
--- decl2.c	2001/02/19 21:44:17
*************** set_decl_namespace (decl, scope, friendp
*** 4536,4541 ****
--- 4536,4544 ----
        if (!old)
  	/* No old declaration at all. */
  	goto complain;
+       /* A template can be explicitly specialized in any namespace.  */
+       if (processing_explicit_instantiation)
+ 	return;
        if (!is_overloaded_fn (decl))
  	/* Don't compare non-function decls with decls_match here,
  	   since it can't check for the correct constness at this
Index: testsuite/g++.old-deja/g++.ns/template15.C
===================================================================
RCS file: template15.C
diff -N template15.C
*** /dev/null	Tue May  5 13:32:27 1998
--- template15.C	Mon Feb 19 13:44:19 2001
***************
*** 0 ****
--- 1,5 ----
+ // Build don't link:
+ // Origin: Mark Mitchell <mark@codesourcery.com>
+ 
+ namespace X {  template <class T> void f () {}   }
+ template void X::f<int> ();


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