Search code examples
c++boost-spirit

Boost Spirit X3 multiple copy constructors specified


I have a annoying warning when inheriting from x3::variant using Boost 1.69.0 with Microsoft Visual Studio 2017 and 2019:

warning C4521: 'boost::spirit::x3::variant<int>': multiple copy constructors specified
note: see reference to class template instantiation 'boost::spirit::x3::variant<int>' being compiled

This is triggered by this code:

#include "boost/spirit/home/x3/support/ast/variant.hpp"
struct si : boost::spirit::x3::variant<int> {};
int main() { si s; }

What can I do to get rid of this warning?

https://coliru.stacked-crooked.com/a/0f4f496a0a18eee4


Solution

  • What can I do to get rid of this warning?

    • Download Boost 1.70
    • Disable the warning globally
    • Suppress the warning by temporary disabling it before Boost includes
    • Tell you compiler to not treat Boost headers as your own, but as system headers (in GCC by using -isystem-includes instead of -I)