https://bugs.llvm.org/show_bug.cgi?id=41241
Bug ID: 41241
Summary: clang complains about constexpr function in case for
switch statement
Product: new-bugs
Version: 8.0
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected]
struct X
{
enum class E
{
A,B
};
static constexpr X A()
{
return X{E::A};
}
static constexpr X B()
{
return X{E::B};
}
constexpr operator E() const
{
return a;
}
E a;
};
template <typename T>
struct Y
{
void f()
{
// without this line clang errs
// const auto & x = this->x;
switch(x)
{
case X::A():
case X::B():
default: return;
}
}
X x = X::A();
};
int main()
{
Y<int>{}.f();
}
the previous code sample does not compile without the commented line or simply
adding this->x to the switch condition
--
You are receiving this mail because:
You are on the CC list for the bug._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs