Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ Clang与模板静态constexpr变量成员一起失败?_C++_C++17_Clang++ - Fatal编程技术网

C++ Clang与模板静态constexpr变量成员一起失败?

C++ Clang与模板静态constexpr变量成员一起失败?,c++,c++17,clang++,C++,C++17,Clang++,我正试图用clang编译一个C++17代码库,但是clang由于分段错误而崩溃。如果我使用这个简单的构造,clang仍然会在所有支持c++17的版本上崩溃。我想知道test::asame的声明是否有问题?看起来,这些模板静态constexpr变量是导致铿锵崩溃的原因: #include<type_traits> using namespace std; struct A{}; struct B{}; template<class U> struct test{ tem

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

#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
#包括
使用名称空间std;
结构A{};
结构B{};
模板
结构测试{
模板
静态constexpr bool asame=相同;
使用type=conditional_t;
静态constexpr bool asameA=测试::asame;
};
静态断言(test::asameA);//=>静态表达式不是整型常量表达式
静态断言(test::asameA);//=>静态表达式不是整型常量表达式
静态断言(是否相同);//=>好的,但是
静态断言(是否相同);//=>也可以!->然后在真正的代码库中发生了当啷的崩溃

编译器崩溃始终是编译器的错误,即使代码不正确。这似乎不是这里的情况。在C++14模式下,Clang也有问题。我同意Jarod-请在bugs.llvm上提交一个bug。org@MarshallClow我要求在llvm bugzilla上有一个帐户。我在等待答复。