在boost :: variant中使用boost :: blank时的编译器警告

Baz*_*Baz 2 c++ boost

我收到以下代码的警告,如果我从变量中删除boost :: blank,则会消失:

namespace DB
{
struct Value{};
struct Container{};
}

typedef boost::variant <boost::blank, DB::Value, DB::Container> CommandData;

struct Command {
    explicit Command(CommandData& _data): data(_data){
    }

    CommandData data;
};

int main()
{
    CommandData commandData;
    Command command(commandData);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

这是什么问题?

这是警告:

1>: warning C4345: behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
1>          c:\boost_1_49_0\boost\variant\variant.hpp(1224) : while compiling class template member function 'boost::variant<T0_,T1,T2>::variant(void)'
1>          with
1>          [
1>              T0_=boost::blank,
1>              T1=DB::Value,
1>              T2=DB::Container
1>          ]
1>          c:\code.h(38) : see reference to class template instantiation 'boost::variant<T0_,T1,T2>' being compiled
1>          with
1>          [
1>              T0_=boost::blank,
1>              T1=DB::Value,
1>              T2=DB::Container
1>          ]
Run Code Online (Sandbox Code Playgroud)

pmr*_*pmr 7

这个警告相当愚蠢.它警告说,MSVC现在做的是正确的,而不是一些古老的版本.你可以用一个关闭它pragma.