https://bugs.llvm.org/show_bug.cgi?id=38247
Bug ID: 38247
Summary: static constexpr variable member template causes clang
crash
Product: clang
Version: unspecified
Hardware: PC
OS: Linux
Status: NEW
Severity: release blocker
Priority: P
Component: C++14
Assignee: unassignedclangb...@nondot.org
Reporter: okan...@gmail.com
CC: llvm-bugs@lists.llvm.org
A basic C++14 construct make Clang crash for all versions of Clang supporting
C++14 I have tested (clang 3.5 to clang 6.0.1).
The use of static constexpr variable member template make clang crash, example:
#include<type_traits>
using namespace std;
struct A{};
struct B{};
template<class U>
struct test
{
template<class T>
static constexpr bool asame =is_same<T,U>::value ;
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<A,typename test<A>::type>::value,""); //=> ok, but
static_assert(is_same<B,typename test<A>::type>::value,""); //=> also ok! ->
then clang crash in real code base
For those having the issue, the solution is to replace member variable template
by member of a template class as in:
template<class U>
struct test
{
template<class T>
struct fix_clang{
static constexpr bool asame =is_same<T,U>::value ;
}
using type = conditional_t< fix_clang<A>::asame ,B ,A>;
static constexpr bool asameA =test<U>::fix_clang<A>::asame ;
};
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs