Does Boost.Variant require certain warnings to be disabled? The following
As recommended (thanks Steve!), I have disabled VC9's C4512 warning to get a
canonical Boost.Variant example to compile (in VC9) without warnings:
#pragma warning( push )
#pragma warning( disable : 4512 )
#include
#pragma warning( pop )
#include <iostream>
using namespace std;
struct vis : public boost::static_visitor<> {
void operator()( int & ) const { cout << "int" << endl; }
void operator()( string & ) const { cout << "string" << endl; }
};
int main( int, char * ) {
boost::variant< int, string > v;
boost::apply_visitor( vis(), v );
return 0;
}
*If* this warning is truly harmless, should this be considered a bug in
Boost.Variant? Shouldn't Boost.Variant disable benign warnings in a
compiler-independent way? Or at least shouldn't the Boost.Variant docs be
updated? Or is this warning part of Boost.Variant's design? If so is there
any way I can change my code above to compile without warnings other without
explicitly suppressing warnings?
Any Boost.Variant authors/maintainers care to comment?
John Fearnside
-----Original Message-----
AMDG
hfye-wila@spamex.com wrote:
program generates a warning for me with VC9:
Warning 4512 is almost always harmless. It's usually caused
by structs containing reference members. You're best off disabling
it.
In Christ,
Steven Watanabe