You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2006/11/08 19:21:07 UTC

svn commit: r472571 - in /incubator/stdcxx/trunk/etc/config/src: EXTERN_MEMBER_TEMPLATE.cpp extern_template_imp.cpp extern_template_imp.h

Author: sebor
Date: Wed Nov  8 10:21:06 2006
New Revision: 472571

URL: http://svn.apache.org/viewvc?view=rev&rev=472571
Log:
2006-11-08  Martin Sebor  <se...@roguewave.com>

	STDCXX-271
	* EXTERN_MEMBER_TEMPLATE.cpp: New test to detect the ability to use
	function template members of a specialization of a class template
	declared extern template.
	* extern_template_imp.cpp (NO_INLINE_MEMBER_TEMPLATE,
	NO_MEMBER_TEMPLATE): Defined macros in response to the corresponding
	configuration macros.
	* extern_template_imp.h (inline_member_template, member_template):
	Declared.

Added:
    incubator/stdcxx/trunk/etc/config/src/EXTERN_MEMBER_TEMPLATE.cpp   (with props)
Modified:
    incubator/stdcxx/trunk/etc/config/src/extern_template_imp.cpp
    incubator/stdcxx/trunk/etc/config/src/extern_template_imp.h

Added: incubator/stdcxx/trunk/etc/config/src/EXTERN_MEMBER_TEMPLATE.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/src/EXTERN_MEMBER_TEMPLATE.cpp?view=auto&rev=472571
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/EXTERN_MEMBER_TEMPLATE.cpp (added)
+++ incubator/stdcxx/trunk/etc/config/src/EXTERN_MEMBER_TEMPLATE.cpp Wed Nov  8 10:21:06 2006
@@ -0,0 +1,44 @@
+// checking for extern template extension
+
+#if defined (_RWSTD_USE_CONFIG)
+#  include "config.h"
+#endif   // _RWSTD_USE_CONFIG
+
+// establish dependencies on the config tests and define config
+// macros used in the header below (the are not autodetected
+// in headers)
+#ifdef _RWSTD_NO_INLINE_MEMBER_TEMPLATE
+#  define NO_INLINE_MEMBER_TEMPLATE
+#endif   // _RWSTD_NO_INLINE_MEMBER_TEMPLATE
+
+#ifdef _RWSTD_NO_MEMBER_TEMPLATE
+#  define NO_MEMBER_TEMPLATE
+#endif   // _RWSTD_NO_MEMBER_TEMPLATE
+
+// include a file containing the definition of a template
+// and an extern template directive referencing an explicit
+// instantiation of the same template in extern_template_imp.o
+#include "extern_template_imp.h"
+
+// establish a dependency on extern_template_imp.o to make sure
+// the extern_template_imp.cpp is compiled before this file
+#ifndef _RWSTD_NO_extern_template_imp
+
+// link with the object file below
+// LDOPTS = ./extern_template_imp.o
+
+#endif   // _RWSTD_NO_extern_template_imp
+
+int main ()
+{
+    S<int> s;
+
+    // call member template functions on a specialization of
+    // a class template explicitly instantiated in one file
+    // and declared extern template in extern_template_imp.h
+    // to detect if the extern template declaration prevents
+    // the implicit instantiation of the member templates
+    // HP aCC 3 and 5 bug -- see STDCXX-270:
+    // http://issues.apache.org/jira/browse/STDCXX-270
+    return s.inline_member_template (0) + s.member_template (0);
+}

Propchange: incubator/stdcxx/trunk/etc/config/src/EXTERN_MEMBER_TEMPLATE.cpp
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/stdcxx/trunk/etc/config/src/EXTERN_MEMBER_TEMPLATE.cpp
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: incubator/stdcxx/trunk/etc/config/src/extern_template_imp.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/src/extern_template_imp.cpp?view=diff&rev=472571&r1=472570&r2=472571
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/extern_template_imp.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/extern_template_imp.cpp Wed Nov  8 10:21:06 2006
@@ -1,4 +1,17 @@
 
+#include <config.h>
+
+// establish dependencies on the config tests and define config
+// macros used in the header below (the are not autodetected
+// in headers)
+#ifdef _RWSTD_NO_INLINE_MEMBER_TEMPLATE
+#  define NO_INLINE_MEMBER_TEMPLATE
+#endif   // _RWSTD_NO_INLINE_MEMBER_TEMPLATE
+
+#ifndef _RWSTD_NO_MEMBER_TEMPLATE
+#  define NO_MEMBER_TEMPLATE
+#endif   // _RWSTD_NO_MEMBER_TEMPLATE
+
 // explicitly instantiate the template defined in the header
 #define INSTANTIATE
 #include "extern_template_imp.h"

Modified: incubator/stdcxx/trunk/etc/config/src/extern_template_imp.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/src/extern_template_imp.h?view=diff&rev=472571&r1=472570&r2=472571
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/extern_template_imp.h (original)
+++ incubator/stdcxx/trunk/etc/config/src/extern_template_imp.h Wed Nov  8 10:21:06 2006
@@ -1,4 +1,10 @@
 
+// avoid including <config.h> here to avoid inadvertently
+// trying to introduce dependencies on other config tests
+// that the config infrastructure won't know about (since
+// it only searches .cpp files for them)
+// #include <config.h>
+
 #if __GNUG__ >= 3
    // disable gcc 3.x (and beyond) error: ISO C++ forbids the use
    // of `extern' on explicit instantiations
@@ -18,6 +24,35 @@
     T baz () const {
         return bar ();
     }
+
+#if defined (NO_INLINE_MEMBER_TEMPLATE)
+
+    int inline_member_template (int) const {
+        return 0;
+    }
+
+#else   // if !defined (NO_INLINE_MEMBER_TEMPLATE)
+
+    template <class U>
+    U inline_member_template (U) const {
+        return U ();
+    }
+
+#endif   // NO_INLINE_MEMBER_TEMPLATE
+
+#if defined (NO_MEMBER_TEMPLATE)
+
+    int member_template (int) const {
+        return 0;
+    }
+
+#else   // if !defined (NO_MEMBER_TEMPLATE)
+
+    template <class U>
+    U member_template (U) const;
+
+#endif   // NO_MEMBER_TEMPLATE
+
 };
 
 template <class T>
@@ -35,6 +70,18 @@
     return 0;
 #endif   // INSTANTIATE
 }
+
+#if !defined (NO_MEMBER_TEMPLATE)
+
+template <class T>
+template <class U>
+U S<T>::member_template (U) const
+{
+    return U ();
+}
+
+#endif   // NO_MEMBER_TEMPLATE
+
 
 #if defined (INSTANTIATE)