Add test for a case in D77598

This covers the DeclPrinter::VisitCXXRecordDecl caller - though also
demonstrates some possible inconsistency in template specialization
printing.
This commit is contained in:
David Blaikie 2021-11-14 18:44:26 -08:00
parent 132bc6e2d4
commit 400eb59adf
1 changed files with 24 additions and 0 deletions

View File

@ -67,3 +67,27 @@ namespace test3 {
template<typename T> A(T) -> A<int>;
// CHECK1: template <typename T> A(T) -> A<int>;
}
namespace test4 {
template <unsigned X, auto A>
struct foo {
static void fn();
};
// Prints using an "integral" template argument. Test that this correctly
// includes the type for the auto argument and omits it for the fixed
// type/unsigned argument (see
// TemplateParameterList::shouldIncludeTypeForArgument)
// CHECK1: template<> struct foo<0, 0L> {
void test() {
foo<0, 0 + 0L>::fn();
}
// Prints using an "expression" template argument. This renders based on the way
// the user wrote the arguments (including that + expression) - so it's not
// powered by the shouldIncludeTypeForArgument functionality.
// Not sure if this it's intentional that these two specializations are rendered
// differently in this way.
// CHECK1: template<> struct foo<1, 0 + 0L> {
template struct foo<1, 0 + 0L>;
}