Handle 128-bits IntegerLiterals in StmtPrinter

This fixes PR35677: "int128_t or uint128_t as non-type template
parameter causes crash when considering invalid constructor".
This commit is contained in:
David Stone 2021-03-25 17:27:13 -04:00 committed by Aaron Ballman
parent 414412d3dc
commit 4b5baa5b82
2 changed files with 19 additions and 0 deletions

View File

@ -1170,6 +1170,10 @@ void StmtPrinter::VisitIntegerLiteral(IntegerLiteral *Node) {
case BuiltinType::ULong: OS << "UL"; break;
case BuiltinType::LongLong: OS << "LL"; break;
case BuiltinType::ULongLong: OS << "ULL"; break;
case BuiltinType::Int128:
break; // no suffix.
case BuiltinType::UInt128:
break; // no suffix.
}
}

View File

@ -0,0 +1,15 @@
// RUN: %clang_cc1 -ast-print -std=c++20 %s -o - | FileCheck %s
template <bool>
struct enable_if {
};
template <__uint128_t x, typename = typename enable_if<x != 0>::type>
void f();
template <__int128_t>
void f();
using T = decltype(f<0>());
// CHECK: using T = decltype(f<0>());