mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-12 09:41:26 +00:00
Use APSInt::isSameValue instead of operator== in a place where two APSInt's
may have different sizes. Fixes PR22017 llvm-svn: 225488
This commit is contained in:
parent
f4ea3d3d9c
commit
94a9ae776d
@ -42,7 +42,11 @@ static void printIntegral(const TemplateArgument &TemplArg,
|
||||
|
||||
if (const EnumType *ET = T->getAs<EnumType>()) {
|
||||
for (const EnumConstantDecl* ECD : ET->getDecl()->enumerators()) {
|
||||
if (ECD->getInitVal() == Val) {
|
||||
// In Sema::CheckTemplateArugment, enum template arguments value are
|
||||
// extended to the size of the integer underlying the enum type. This
|
||||
// may create a size difference between the enum value and template
|
||||
// argument value, requiring isSameValue here instead of operator==.
|
||||
if (llvm::APSInt::isSameValue(ECD->getInitVal(), Val)) {
|
||||
ECD->printQualifiedName(Out, Policy);
|
||||
return;
|
||||
}
|
||||
|
11
clang/test/SemaTemplate/enum-bool.cpp
Normal file
11
clang/test/SemaTemplate/enum-bool.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
// %RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o %t
|
||||
|
||||
enum E : bool { A };
|
||||
template <E>
|
||||
struct S {
|
||||
struct Inner {
|
||||
Inner() {}
|
||||
};
|
||||
};
|
||||
|
||||
template class S<A>;
|
Loading…
Reference in New Issue
Block a user