From 735804d63678f44535c90192411b8a74b1d44747 Mon Sep 17 00:00:00 2001 From: Daniel James Date: Sat, 19 Nov 2011 23:29:24 +0000 Subject: [PATCH] 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. [SVN r75561] --- include/boost/detail/container_fwd.hpp | 7 +++++-- test/container_fwd/Jamfile | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/boost/detail/container_fwd.hpp b/include/boost/detail/container_fwd.hpp index 7211134..01820ae 100644 --- a/include/boost/detail/container_fwd.hpp +++ b/include/boost/detail/container_fwd.hpp @@ -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 @@ namespace std template struct char_traits; #endif +#if defined(BOOST_CONTAINER_FWD_COMPLEX_STRUCT) + template struct complex; +#else template class complex; +#endif #if !defined(BOOST_CONTAINER_FWD_BAD_DEQUE) template class deque; diff --git a/test/container_fwd/Jamfile b/test/container_fwd/Jamfile index b39d447..ab55bc2 100644 --- a/test/container_fwd/Jamfile +++ b/test/container_fwd/Jamfile @@ -11,6 +11,7 @@ project detail/test/container_fwd intel:on gcc:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion" darwin:"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion" + clang:"-pedantic -Wextra -Wmismatched-tags" on ;