[clang] 50fdd7d - Add more test coverage for D77598

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


Author: David Blaikie
Date: 2021-11-14T21:09:11-08:00
New Revision: 50fdd7df827137c8465abafa82a6bae7c87096c5

URL: https://github.com/llvm/llvm-project/commit/50fdd7df827137c8465abafa82a6bae7c87096c5
DIFF: https://github.com/llvm/llvm-project/commit/50fdd7df827137c8465abafa82a6bae7c87096c5.diff

LOG: Add more test coverage for D77598

Add coverage to demonstrate why including the type of template
parameters is necessary to disambiguate function template
specializations.

Test courtesy of Richard Smith

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 b08bc76ed179..3d26eb917c12 100644
--- a/clang/test/AST/ast-dump-templates.cpp
+++ b/clang/test/AST/ast-dump-templates.cpp
@@ -93,3 +93,14 @@ void test() {
 // CHECK1: {{^    }}template<> struct foo<1, 0 + 0L> {
 template struct foo<1, 0 + 0L>;
 }
+
+namespace test5 {
+template<long> void f() {}
+void (*p)() = f<0>;
+template<unsigned = 0> void f() {}
+void (*q)() = f<>;
+// Not perfect - this code in the dump would be ambiguous, but it's the best we
+// can do to 
diff erentiate these two implicit specializations.
+// CHECK1: template<> void f<0L>()
+// CHECK1: template<> void f<0U>()
+}


        


More information about the cfe-commits mailing list