diff options
author | Richard Trieu <rtrieu@google.com> | 2015-01-09 00:58:16 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2015-01-09 00:58:16 +0000 |
commit | 94a9ae776d940fe05985c9a984d1a40534eebdeb (patch) | |
tree | 5b2a38838b8cdb46aada3c38cd2ba4b8b95af735 /clang/lib/AST/TemplateBase.cpp | |
parent | f4ea3d3d9c624813f03679021a064687b56f7c08 (diff) | |
download | bcm5719-llvm-94a9ae776d940fe05985c9a984d1a40534eebdeb.tar.gz bcm5719-llvm-94a9ae776d940fe05985c9a984d1a40534eebdeb.zip |
Use APSInt::isSameValue instead of operator== in a place where two APSInt's
may have different sizes. Fixes PR22017
llvm-svn: 225488
Diffstat (limited to 'clang/lib/AST/TemplateBase.cpp')
-rw-r--r-- | clang/lib/AST/TemplateBase.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/lib/AST/TemplateBase.cpp b/clang/lib/AST/TemplateBase.cpp index d0c938d9243..f8b73cb8f89 100644 --- a/clang/lib/AST/TemplateBase.cpp +++ b/clang/lib/AST/TemplateBase.cpp @@ -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; } |