gpt4 book ai didi

c++ - 如何为 gcc-trunk 报告这个 ICE

转载 作者:塔克拉玛干 更新时间:2023-11-03 07:10:35 25 4
gpt4 key购买 nike

我想让这段代码工作

#include <cstddef>

template <bool B, auto T, auto F>
struct conditional { static constexpr auto value = T; };

template <auto T, auto F>
struct conditional<false, T, F> { static constexpr auto value = F; };

template <std::size_t N, auto... Dims>
struct static_extent;

template <std::size_t N>
struct static_extent<N> {
static constexpr std::size_t value = 0;
};

template <std::size_t N, auto Dim, auto... Dims>
struct static_extent<N, Dim, Dims...> {
static constexpr auto value =
conditional<
(N == 0),
Dim,
static_extent<N-1, Dims...>::value
>::value;
};

enum class dynamic_extent_tag {};
inline constexpr dynamic_extent_tag dyn{-1};

int main()
{
static_assert(static_extent<1, 33, dyn, 19>::value == dyn, "");
static_assert(static_extent<0, 33, dyn, 19>::value == 33, "");
}

我已经在 godbolt 上测试过了它似乎适用于 clang。不幸的是,我绑定(bind)到 gcc,它给了我一个 ICE 和一个堆栈跟踪。我试着在他们的 bugzilla 上冲浪我有点迷路了。

是否值得为主干版本提交错误报告?它甚至想要吗?有人知道这是否已经是一个已知问题吗?我查找了关键字“ice”,但在那里找不到任何有用的信息。

最佳答案

是的,应该报告所有 ICE。

我打开了https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79556给你。

谢谢。

关于c++ - 如何为 gcc-trunk 报告这个 ICE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42260453/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com