From stdcxx-commits-return-1011-apmail-incubator-stdcxx-commits-archive=incubator.apache.org@incubator.apache.org Wed Nov 08 18:21:36 2006 Return-Path: Delivered-To: apmail-incubator-stdcxx-commits-archive@www.apache.org Received: (qmail 91280 invoked from network); 8 Nov 2006 18:21:35 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 8 Nov 2006 18:21:35 -0000 Received: (qmail 70674 invoked by uid 500); 8 Nov 2006 18:21:47 -0000 Delivered-To: apmail-incubator-stdcxx-commits-archive@incubator.apache.org Received: (qmail 70661 invoked by uid 500); 8 Nov 2006 18:21:47 -0000 Mailing-List: contact stdcxx-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: stdcxx-dev@incubator.apache.org Delivered-To: mailing list stdcxx-commits@incubator.apache.org Received: (qmail 70650 invoked by uid 99); 8 Nov 2006 18:21:46 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Nov 2006 10:21:46 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Nov 2006 10:21:35 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id B08AB1A9846; Wed, 8 Nov 2006 10:21:07 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r472571 - in /incubator/stdcxx/trunk/etc/config/src: EXTERN_MEMBER_TEMPLATE.cpp extern_template_imp.cpp extern_template_imp.h Date: Wed, 08 Nov 2006 18:21:07 -0000 To: stdcxx-commits@incubator.apache.org From: sebor@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061108182107.B08AB1A9846@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 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 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 + +// 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 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 + #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 + 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 + U member_template (U) const; + +#endif // NO_MEMBER_TEMPLATE + }; template @@ -35,6 +70,18 @@ return 0; #endif // INSTANTIATE } + +#if !defined (NO_MEMBER_TEMPLATE) + +template +template +U S::member_template (U) const +{ + return U (); +} + +#endif // NO_MEMBER_TEMPLATE + #if defined (INSTANTIATE)