首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为什么boost log break会提升GMP multiprecision?

为什么boost log break会提升GMP multiprecision?
EN

Stack Overflow用户
提问于 2019-09-10 00:06:57
回答 1查看 363关注 0票数 4

我刚刚在Mac OS Mojave 10.14.6上使用Homebrew将我的boost升级到了1.71.0。执行此操作后,以下程序无法编译:

代码语言:javascript
复制
#include <boost/log/sinks/text_ostream_backend.hpp>
#include <boost/multiprecision/gmp.hpp>

int main() {}
代码语言:javascript
复制
$ clang++ -v
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
代码语言:javascript
复制
$ clang++ -std=c++14 boost_gmp.cpp -o boost_gmp
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:284:10: error: no template named '_mp_size'; did you mean 'mp11::mp_size'?
      if(mpf_sgn(m_data) == 0)
         ^
/usr/local/include/gmp.h:2239:26: note: expanded from macro 'mpf_sgn'
#define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0)
                         ^
/usr/local/include/boost/mp11/list.hpp:45:19: note: 'mp11::mp_size' declared here
template<class L> using mp_size = typename detail::mp_size_impl<L>::type;
                  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:284:10: error: no member named '_mp_size' in '__mpf_struct'
      if(mpf_sgn(m_data) == 0)
         ^~~~~~~~~~~~~~~
/usr/local/include/gmp.h:2239:26: note: expanded from macro 'mpf_sgn'
#define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0)
                    ~~~  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:372:84: error: no template named '_mp_size'; did you mean 'mp11::mp_size'?
      boost::multiprecision::detail::format_float_string(result, e, org_digits, f, mpf_sgn(m_data) == 0);
                                                                                   ^
/usr/local/include/gmp.h:2239:26: note: expanded from macro 'mpf_sgn'
#define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0)
                         ^
/usr/local/include/boost/mp11/list.hpp:45:19: note: 'mp11::mp_size' declared here
template<class L> using mp_size = typename detail::mp_size_impl<L>::type;
                  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:372:84: error: no member named '_mp_size' in '__mpf_struct'
      boost::multiprecision::detail::format_float_string(result, e, org_digits, f, mpf_sgn(m_data) == 0);
                                                                                   ^~~~~~~~~~~~~~~
/usr/local/include/gmp.h:2239:26: note: expanded from macro 'mpf_sgn'
#define mpf_sgn(F) ((F)->_mp_size < 0 ? -1 : (F)->_mp_size > 0)
                    ~~~  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1323:27: error: no template named '_mp_size'; did you mean 'mp11::mp_size'?
      if((base != 10) && (mpz_sgn(m_data) < 0))
                          ^
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                         ^
/usr/local/include/boost/mp11/list.hpp:45:19: note: 'mp11::mp_size' declared here
template<class L> using mp_size = typename detail::mp_size_impl<L>::type;
                  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1323:27: error: no member named '_mp_size' in '__mpz_struct'
      if((base != 10) && (mpz_sgn(m_data) < 0))
                          ^~~~~~~~~~~~~~~
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                    ~~~  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1364:14: error: no template named '_mp_size'; did you mean 'mp11::mp_size'?
      return mpz_cmp_si(m_data, i);
             ^
/usr/local/include/gmp.h:2249:6: note: expanded from macro 'mpz_cmp_si'
   ? mpz_cmp_ui (Z, __GMP_CAST (unsigned long, SI))                     \
     ^
/usr/local/include/gmp.h:2246:6: note: expanded from macro 'mpz_cmp_ui'
   ? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI))
     ^
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                         ^
/usr/local/include/boost/mp11/list.hpp:45:19: note: 'mp11::mp_size' declared here
template<class L> using mp_size = typename detail::mp_size_impl<L>::type;
                  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1364:14: error: no member named '_mp_size' in '__mpz_struct'
      return mpz_cmp_si(m_data, i);
             ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gmp.h:2249:6: note: expanded from macro 'mpz_cmp_si'
   ? mpz_cmp_ui (Z, __GMP_CAST (unsigned long, SI))                     \
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gmp.h:2246:6: note: expanded from macro 'mpz_cmp_ui'
   ? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI))
     ^~~~~~~~~~~
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                    ~~~  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1369:14: error: no template named '_mp_size'; did you mean 'mp11::mp_size'?
      return mpz_cmp_ui(m_data, i);
             ^
/usr/local/include/gmp.h:2246:6: note: expanded from macro 'mpz_cmp_ui'
   ? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI))
     ^
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                         ^
/usr/local/include/boost/mp11/list.hpp:45:19: note: 'mp11::mp_size' declared here
template<class L> using mp_size = typename detail::mp_size_impl<L>::type;
                  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1369:14: error: no member named '_mp_size' in '__mpz_struct'
      return mpz_cmp_ui(m_data, i);
             ^~~~~~~~~~~~~~~~~~~~~
/usr/local/include/gmp.h:2246:6: note: expanded from macro 'mpz_cmp_ui'
   ? mpz_sgn (Z) : _mpz_cmp_ui (Z,UI))
     ^~~~~~~~~~~
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                    ~~~  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1410:11: error: no template named '_mp_size'; did you mean 'mp11::mp_size'?
   return mpz_sgn(val.data()) == 0;
          ^
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                         ^
/usr/local/include/boost/mp11/list.hpp:45:19: note: 'mp11::mp_size' declared here
template<class L> using mp_size = typename detail::mp_size_impl<L>::type;
                  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1410:11: error: no member named '_mp_size' in '__mpz_struct'
   return mpz_sgn(val.data()) == 0;
          ^~~~~~~~~~~~~~~~~~~
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                    ~~~  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1653:11: error: no template named '_mp_size'; did you mean 'mp11::mp_size'?
   return mpz_sgn(val.data());
          ^
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                         ^
/usr/local/include/boost/mp11/list.hpp:45:19: note: 'mp11::mp_size' declared here
template<class L> using mp_size = typename detail::mp_size_impl<L>::type;
                  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1653:11: error: no member named '_mp_size' in '__mpz_struct'
   return mpz_sgn(val.data());
          ^~~~~~~~~~~~~~~~~~~
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                    ~~~  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1657:8: error: no template named '_mp_size'; did you mean 'mp11::mp_size'?
   if (mpz_sgn(val.data()) < 0)
       ^
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                         ^
/usr/local/include/boost/mp11/list.hpp:45:19: note: 'mp11::mp_size' declared here
template<class L> using mp_size = typename detail::mp_size_impl<L>::type;
                  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1657:8: error: no member named '_mp_size' in '__mpz_struct'
   if (mpz_sgn(val.data()) < 0)
       ^~~~~~~~~~~~~~~~~~~
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                    ~~~  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1668:17: error: no template named '_mp_size'; did you mean 'mp11::mp_size'?
      *result = mpz_sgn(val.data()) < 0 ? (std::numeric_limits<long>::min)()  : (std::numeric_limits<long>::max)();
                ^
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                         ^
/usr/local/include/boost/mp11/list.hpp:45:19: note: 'mp11::mp_size' declared here
template<class L> using mp_size = typename detail::mp_size_impl<L>::type;
                  ^
In file included from boost_gmp.cpp:2:
/usr/local/include/boost/multiprecision/gmp.hpp:1668:17: error: no member named '_mp_size' in '__mpz_struct'
      *result = mpz_sgn(val.data()) < 0 ? (std::numeric_limits<long>::min)()  : (std::numeric_limits<long>::max)();
                ^~~~~~~~~~~~~~~~~~~
/usr/local/include/gmp.h:2238:26: note: expanded from macro 'mpz_sgn'
#define mpz_sgn(Z) ((Z)->_mp_size < 0 ? -1 : (Z)->_mp_size > 0)
                    ~~~  ^
18 errors generated.

卸下#include <boost/log/sinks/text_ostream_backend.hpp>即可解决问题。更改includes的顺序也可以解决这个问题。到底怎么回事?

EN

回答 1

Stack Overflow用户

发布于 2019-09-11 01:15:30

原来是个Clang parser bug

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57857572

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档