https://bugs.llvm.org/show_bug.cgi?id=40982
Bug ID: 40982
Summary: Crash on switch statements of non-integer types
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected], [email protected],
[email protected]
The following code causes a crash with an assert failure no Clang, rather than
producing a compile error:
clang::ExprResult clang::Sema::CheckConvertedConstantExpression(clang::Expr*,
clang::QualType, llvm::APSInt&, clang::Sema::CCEKind): Assertion
`T->isIntegralOrEnumerationType() && "unexpected converted const type"' failed.
Expected:
error: statement requires expression of integer type ('NOT_AN_INTEGRAL_TYPE'
invalid)
switch(Bad) {
=================================
struct NOT_AN_INTEGRAL_TYPE { };
template<typename T> struct foo
{
NOT_AN_INTEGRAL_TYPE Bad;
void run();
};
template<typename T> void foo<T>::run() {
switch(Bad) {
case 0: break; // Literally breaks Clang.
}
}
--
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