Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75561 - in trunk: boost/detail libs/detail/test/container_fwd
From: dnljms_at_[hidden]
Date: 2011-11-19 18:29:25


Author: danieljames
Date: 2011-11-19 18:29:24 EST (Sat, 19 Nov 2011)
New Revision: 75561
URL: http://svn.boost.org/trac/boost/changeset/75561

Log:
Detail: `complex` is a struct in Dinkumware.

IIRC it's `class` in SGI's STL and most other implementations. The state
for similar warnings for the compilers that I've looked at:

- Visual C++ never warns because I used a pragma to disable the warning.
- GCC never warns with its standard library since it contains a
  `system_header` pragma. It might warn for other libraries.
- Clang respects GCC's pragma so it never warns for GCC's standard
  library. Forward declarations are disabled for libc++ so this isn't an
  issue there. It does warn when using Dinkumware and possibly other
  standard libraries.

I'm tempted to make container forwarding 'opt-in' rather than 'opt-out'.
Or maybe only enable for compiler/library combinations where it's known
to work.
Text files modified:
   trunk/boost/detail/container_fwd.hpp | 7 +++++--
   trunk/libs/detail/test/container_fwd/Jamfile | 1 +
   2 files changed, 6 insertions(+), 2 deletions(-)

Modified: trunk/boost/detail/container_fwd.hpp
==============================================================================
--- trunk/boost/detail/container_fwd.hpp (original)
+++ trunk/boost/detail/container_fwd.hpp 2011-11-19 18:29:24 EST (Sat, 19 Nov 2011)
@@ -63,8 +63,7 @@
 # elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
      // Dinkumware Library (this has to appear after any possible replacement
      // libraries)
- //
- // Works fine.
+# define BOOST_CONTAINER_FWD_COMPLEX_STRUCT
 # else
 # define BOOST_DETAIL_NO_CONTAINER_FWD
 # endif
@@ -117,7 +116,11 @@
     template <class charT> struct char_traits;
 #endif
 
+#if defined(BOOST_CONTAINER_FWD_COMPLEX_STRUCT)
+ template <class T> struct complex;
+#else
     template <class T> class complex;
+#endif
 
 #if !defined(BOOST_CONTAINER_FWD_BAD_DEQUE)
     template <class T, class Allocator> class deque;

Modified: trunk/libs/detail/test/container_fwd/Jamfile
==============================================================================
--- trunk/libs/detail/test/container_fwd/Jamfile (original)
+++ trunk/libs/detail/test/container_fwd/Jamfile 2011-11-19 18:29:24 EST (Sat, 19 Nov 2011)
@@ -11,6 +11,7 @@
         <toolset>intel:<warnings>on
         <toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion"
         <toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion"
+ <toolset>clang:<cxxflags>"-pedantic -Wextra -Wmismatched-tags"
         <warnings-as-errors>on
   ;
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk