[clang] 400eb59 - Add test for a case in D77598

David Blaikie via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 14 21:00:46 PST 2021


Author: David Blaikie
Date: 2021-11-14T20:45:16-08:00
New Revision: 400eb59adf43b29af3117c163cf770e6d6e514f7

URL: https://github.com/llvm/llvm-project/commit/400eb59adf43b29af3117c163cf770e6d6e514f7
DIFF: https://github.com/llvm/llvm-project/commit/400eb59adf43b29af3117c163cf770e6d6e514f7.diff

LOG: Add test for a case in D77598

This covers the DeclPrinter::VisitCXXRecordDecl caller - though also
demonstrates some possible inconsistency in template specialization
printing.

Added: 
    

Modified: 
    clang/test/AST/ast-dump-templates.cpp

Removed: 
    


################################################################################
diff  --git a/clang/test/AST/ast-dump-templates.cpp b/clang/test/AST/ast-dump-templates.cpp
index ab4a7356028e1..cb2994edcc67e 100644
--- a/clang/test/AST/ast-dump-templates.cpp
+++ b/clang/test/AST/ast-dump-templates.cpp
@@ -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
+// 
diff erently in this way.
+// CHECK1: template<> struct foo<1, 0 + 0L> {
+template struct foo<1, 0 + 0L>;
+}


        


More information about the cfe-commits mailing list