Boost logo

Boost Users :

From: hfye-wila_at_[hidden]
Date: 2008-07-23 11:26:52


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 <boost/variant.hpp>
#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_at_[hidden] wrote:
> Does Boost.Variant require certain warnings to be disabled? The following
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


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