Boost logo

Boost Users :

From: hfye-wila_at_[hidden]
Date: 2008-07-23 13:57:56


I agree with Steve that the C4512 warning is a low-priority bug: it is
easily worked around and it's only a level 4 warning. But, I must not be
understanding Boost.Variant (1.35.1) because the following simple example
generates several other VC9 warnings: C4345 (level 2) and C4100 (level 4):

  #include <boost/config.hpp>
  #ifdef BOOST_MSVC
  # pragma warning( push )
  # pragma warning( disable : 4512 )
  #endif
  #include <boost/variant.hpp>
  #ifdef BOOST_MSVC
  # pragma warning( pop )
  #endif
  #include <iostream>
  using namespace std;
  
  struct C1 {};
  struct C2 {};
  
  struct vis : public boost::static_visitor<> {
     void operator()( C1 & ) const { cout << "C1" << endl; }
     void operator()( C2 & ) const { cout << "C2" << endl; }
  };
  
  int main( int, char * ) {
     boost::variant< C1, C2 > v;
     boost::apply_visitor( vis(), v );
     return 0;
  }

Disabling these in the manner above works but I'm hoping one of its
authors/maintainers can comment on intended usage of Boost.Variant with VC9?
I'm wary of disabling each warning I encounter. That makes it difficult for
me to know which warnings are known to be harmless and which indicate errors
in my code.

BTW: By "compiler-independent way" I mean using <boost/config.hpp> macros to
wrap compiler-specific pragmas (as above).

John Fearnside

-----Original Message-----

AMDG

hfye-wila_at_[hidden] wrote:
> *If* this warning is truly harmless, should this be considered a bug in
> Boost.Variant?

I consider this a low priority bug.

> Shouldn't Boost.Variant disable benign warnings in a
> compiler-independent way?

This warning is Visual Studio specific.

In Christ,
Steven Watanabe

_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net