我正在使用boost 1.63,并且在编译包含#include <boost/algorithm/string.hpp>
的应用程序时使用。
海湾合作委员会抱怨:
In file included from /opt/boost/boost/mpl/aux_/na_assert.hpp:23,
from /opt/boost/boost/mpl/arg.hpp:25,
from /opt/boost/boost/mpl/placeholders.hpp:24,
from /opt/boost/boost/iterator/iterator_categories.hpp:17,
from /opt/boost/boost/iterator/iterator_facade.hpp:14,
from /opt/boost/boost/range/iterator_range_core.hpp:27,
from /opt/boost/boost/range/iterator_range.hpp:13,
from /opt/boost/boost/range/as_literal.hpp:22,
from /opt/boost/boost/algorithm/string/trim.hpp:19,
from /opt/boost/boost/algorithm/string.hpp:19,
from [my source that includes <boost/algorithm/string.hpp>]
/opt/boost/boost/mpl/assert.hpp:188:21: warning: unnecessary parentheses in declaration of ‘assert_arg’ [-Wparentheses]
failed ************ (Pred::************
^
/opt/boost/boost/mpl/assert.hpp:193:21: warning: unnecessary parentheses in declaration of ‘assert_not_arg’ [-Wparentheses]
failed ************ (boost::mpl::not_<Pred>::************
^
我查看了来源,抱怨的部分是:
template< typename Pred >
failed ************ (Pred::************
assert_arg( void (*)(Pred), typename assert_arg_pred<Pred>::type )
);
template< typename Pred >
failed ************ (boost::mpl::not_<Pred>::************
assert_not_arg( void (*)(Pred), typename assert_arg_pred_not<Pred>::type )
);
问题:
failed ************ (Pred::************
是什么?语法对我来说很奇怪。我在网上搜索,最接近的相关人物是this。但是它的解决方案似乎只是抑制了警告。
谢谢!
答案 0 :(得分:4)
通常,GCC和Clang自动禁止来自/usr
中标头的警告。但是,看来/opt
并非如此。要告诉编译器应该将boost头视为系统头,请使用-isystem
而不是-I
将boost头添加到包含路径中。