mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-24 06:10:12 +00:00
878a24ee24
This patch reapplies commit 759948467e
. Patch was reverted due to a
clang-tidy test fail on Windows. The test has been modified. There
are no additional code changes.
Patch was tested with ninja check-all on Windows and Linux.
Summary of code changes:
Clang currently crashes for switch statements inside a template when the
condition is a non-integer field member because contextual implicit
conversion is skipped when parsing the condition. This conversion is
however later checked in an assert when the case statement is handled.
The conversion is skipped when parsing the condition because
the field member is set as type-dependent based on its containing class.
This patch sets the type dependency based on the field's type instead.
This patch fixes Bug 40982.
15 lines
314 B
C++
15 lines
314 B
C++
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
|
|
struct NOT_AN_INTEGRAL_TYPE {};
|
|
|
|
template <typename T>
|
|
struct foo {
|
|
NOT_AN_INTEGRAL_TYPE Bad;
|
|
void run() {
|
|
switch (Bad) { // expected-error {{statement requires expression of integer type ('NOT_AN_INTEGRAL_TYPE' invalid)}}
|
|
case 0:
|
|
break;
|
|
}
|
|
}
|
|
};
|