【发布时间】:2017-07-04 18:25:18
【问题描述】:
我想让这段代码工作
#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 一起使用。不幸的是,我被绑定到 gcc,它给了我一个 ICE 和一个堆栈跟踪。我试图在他们的bugzilla 上冲浪,我有点迷路了。
是否值得为主干版本提交错误报告?它甚至想要吗? 有人知道这是否已经是一个已知问题吗? 我查找了关键字“ice”,但在那里找不到任何有用的东西。
【问题讨论】:
-
“是否值得为主干版本提交错误报告?是否需要?”我会说,是的 - 可能比任何其他版本都更重要版本!
-
看来只有登录后才能搜索 bugzilla,而且由于垃圾邮件,目前不允许使用新帐户。因此,除非有人为您提交此错误,否则您将不走运。
-
好吧,我想它现在可能在 bugzilla 中。我今天检查了,我相信今天有一个提交也可能触及我的问题。 gcc.gnu.org/bugzilla/show_bug.cgi?id=79549
标签: c++ gcc c++17 bug-reporting