stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r631232 - in /stdcxx/branches/4.2.x/etc/config/src: EXTERN_FUNCTION_TEMPLATE.cpp extern_function_template_imp.cpp extern_function_template_imp.h
Date Tue, 26 Feb 2008 14:41:45 GMT
Author: faridz
Date: Tue Feb 26 06:41:44 2008
New Revision: 631232

URL: http://svn.apache.org/viewvc?rev=631232&view=rev
Log:
2008-02-26  Farid Zaripov  <farid_zaripov@epam.com>

	Merged r627616 from trunk.
	* etc/config/src/extern_function_template_imp.h: New header file to
	check the extern function templates.
	* etc/config/src/extern_function_template_imp.cpp: Removed definitions
	of struct S<> and foobar<>(), #included extern_function_template_imp.h.
	* etc/config/src/EXTERN_FUNCTION_TEMPLATE.cpp: Ditto.

Added:
    stdcxx/branches/4.2.x/etc/config/src/extern_function_template_imp.h
      - copied unchanged from r631225, stdcxx/trunk/etc/config/src/extern_function_template_imp.h
Modified:
    stdcxx/branches/4.2.x/etc/config/src/EXTERN_FUNCTION_TEMPLATE.cpp
    stdcxx/branches/4.2.x/etc/config/src/extern_function_template_imp.cpp

Modified: stdcxx/branches/4.2.x/etc/config/src/EXTERN_FUNCTION_TEMPLATE.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/etc/config/src/EXTERN_FUNCTION_TEMPLATE.cpp?rev=631232&r1=631231&r2=631232&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/etc/config/src/EXTERN_FUNCTION_TEMPLATE.cpp (original)
+++ stdcxx/branches/4.2.x/etc/config/src/EXTERN_FUNCTION_TEMPLATE.cpp Tue Feb 26 06:41:44
2008
@@ -22,39 +22,23 @@
  * 
  **************************************************************************/
 
-// establish a dependency on extern_function_template_imp.{cpp,o}
+// include a file containing the definition of a template
+// and an extern template directive referencing an explicit
+// instantiation of the same template in extern_function_template_imp.o
+
+#include "extern_function_template_imp.h"
+
+// establish a dependency on extern_function_template_imp.o to make sure
+// the extern_function_template_imp.cpp is compiled before this file
 #ifndef _RWSTD_NO_extern_function_template_imp
 
-// link the object file produced by compiling this file
-// with the object file below
+// link with the object file below
 // LDOPTS = extern_function_template_imp.o
 
 #endif   // _RWSTD_NO_extern_function_template_imp
 
-
-template <class T>
-struct S
-{
-    T t;
-};
-
-
-template <class T>
-S<T> foobar (S<T> s)
-{
-    // foobar<int>() explicitly instantiated in extern_function_template_imp.cpp
-    // is defined to set s.t to 1
-    s.t = -1;
-
-    return s;
-}
-
-extern template S<int> foobar (S<int>);
-
 int main ()
 {
-    // S<int>::bar () is defined to return 1 in extern_function_template_imp.o
-
     S<int> s;
 
     int res = 0;

Modified: stdcxx/branches/4.2.x/etc/config/src/extern_function_template_imp.cpp
URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/etc/config/src/extern_function_template_imp.cpp?rev=631232&r1=631231&r2=631232&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/etc/config/src/extern_function_template_imp.cpp (original)
+++ stdcxx/branches/4.2.x/etc/config/src/extern_function_template_imp.cpp Tue Feb 26 06:41:44
2008
@@ -21,21 +21,6 @@
  * 
  **************************************************************************/
 
-template <class T>
-struct S
-{
-    T t;
-};
-
-template <class T>
-S<T> foobar (S<T> s)
-{
-    s.t = 1;
-
-    return s;
-}
-
-template S<int> foobar (S<int>);
-
-// extern template S<int> foobar(S<int>) declared
-// in EXTERN_FUNCTION_TEMPLATE.cpp returns -1
+// explicitly instantiate the template defined in the header
+#define INSTANTIATE
+#include "extern_function_template_imp.h"



Mime
View raw message