' fpClassify':含糊不清的呼叫对超载功能

发布于 2025-01-21 05:32:19 字数 1479 浏览 1 评论 0 原文

我成功地在MacBook上以及带有Intel编译器的服务器上编译了代码库。当我通过公司的连续集成测试(具有其自身的构建系统)运行它时,我会在编译中遇到以下错误。

..\corecrt_math.h(415): error C2668: 'fpclassify': ambiguous call to overloaded function
..\corecrt_math.h(300): note: could be 'int fpclassify(long double) noexcept'
..\corecrt_math.h(295): note: or       'int fpclassify(double) noexcept'
..\corecrt_math.h(290): note: or       'int fpclassify(float) noexcept'
..\corecrt_math.h(415): note: while trying to match the argument list '(_Ty)'
        with
        [
            _Ty=kc20::wrapped_int8::underlying
        ]
/path/to/file/kernel.cpp(69): note: see reference to function template instantiation 'bool isnan<integer_type>(_Ty) noexcept' being compiled
        with
        [
            integer_type=kc20::wrapped_int8::underlying,
            _Ty=kc20::wrapped_int8::underlying
        ]

请注意, kc20 是一个名称空间,包含 wrapped_int8 struct。 wrapped_int8 定义为

struct alignas(1) wrapped_int8 {
  using underlying = int8_t;
  int8_t value;
  // some other function definitions
};

kc20 :: wrapped_int8 :: ustlying 只是 int8_t 。在错误消息中,它似乎仅列出 fpClassify in =“ nofollow noreferrer”> https://en.cppreference.com/w/cpp/numeric/math/math/fpclassify 。我的代码应该使用此链接的情况(4),因为它是一个积分类型。这里的歧义是什么?

I successfully compiled a codebase on my macbook and also on a server with intel compilers. When I run it through my company's continuous integrating testing, which has its own build system, I am getting the following error in the compilation.

..\corecrt_math.h(415): error C2668: 'fpclassify': ambiguous call to overloaded function
..\corecrt_math.h(300): note: could be 'int fpclassify(long double) noexcept'
..\corecrt_math.h(295): note: or       'int fpclassify(double) noexcept'
..\corecrt_math.h(290): note: or       'int fpclassify(float) noexcept'
..\corecrt_math.h(415): note: while trying to match the argument list '(_Ty)'
        with
        [
            _Ty=kc20::wrapped_int8::underlying
        ]
/path/to/file/kernel.cpp(69): note: see reference to function template instantiation 'bool isnan<integer_type>(_Ty) noexcept' being compiled
        with
        [
            integer_type=kc20::wrapped_int8::underlying,
            _Ty=kc20::wrapped_int8::underlying
        ]

Note that kc20 is a namespace that contains the wrapped_int8 struct. wrapped_int8 is defined as

struct alignas(1) wrapped_int8 {
  using underlying = int8_t;
  int8_t value;
  // some other function definitions
};

so kc20::wrapped_int8::underlying is just int8_t. In the error message, it seems to only list the first 3 overloads of fpclassify in https://en.cppreference.com/w/cpp/numeric/math/fpclassify . My code should be using case (4) of this link since it's an integral type. What is the ambiguity here?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文