Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion clang/lib/AST/TemplateBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,14 @@ static void printIntegral(const TemplateArgument &TemplArg, raw_ostream &Out,
} else
Out << "(" << T->getCanonicalTypeInternal().getAsString(Policy) << ")"
<< Val;
} else
} else {
Out << Val;
// Handle cases where the value is too large to fit into the underlying type
// i.e. where the unsignedness matters.
if (T->isBuiltinType())
if (Val.isUnsigned() && Val.getBitWidth() == 64 && Val.countLeadingOnes())
Out << "ULL";
}
}

static unsigned getArrayDepth(QualType type) {
Expand Down
7 changes: 7 additions & 0 deletions clang/test/AST/ast-print-integral-template-args.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// RUN: %clang_cc1 -ast-print -std=c++17 -Wno-implicitly-unsigned-literal %s -o - | FileCheck %s

template <unsigned long long N>
struct Foo {};

Foo<9223372036854775810> x;
// CHECK: template<> struct Foo<9223372036854775810ULL> {