铛失败,模板静态constexpr变量成员?

时间:2018-07-19 21:51:02

标签: c++ c++17 clang++

我正在尝试使用clang编译C ++ 17代码库,但是clang崩溃并出现段错误。如果我使用这种简单的结构,则在支持c ++ 17的所有版本上,clang仍然会崩溃。我想知道test::asame的声明是否有问题?看起来这些模板静态constexpr变量是导致clang崩溃的原因:

#include<type_traits>
using namespace std;
struct A{};
struct B{};
template<class U>
struct test{
  template<class T>
  static constexpr bool asame =is_same_v<T,U> ;
  using type =  conditional_t< asame<A> ,B ,A>;
  static constexpr bool asameA =test<U>::asame<A> ;
  };
static_assert(test<A>::asameA); //=> static expression is not an integral constant expression
static_assert(test<B>::asameA); //=> static expression is not an integral constant expression
static_assert(is_same_v<A,typename test<A>::type>); //=> ok, but
static_assert(is_same_v<B,typename test<A>::type>); //=> also ok! -> then clang crash in real code base

0 个答案:

没有答案
相关问题