[PATCH] D57235: [AST] Add structural eq tests for template args
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jan 25 05:36:43 PST 2019
martong created this revision.
martong added reviewers: a_sidorin, shafik.
Herald added subscribers: cfe-commits, gamesh411, Szelethus, dkrupp, rnkovacs.
New tests added to verify equivalency of templates when their
parameters are different.
Repository:
rC Clang
https://reviews.llvm.org/D57235
Files:
unittests/AST/StructuralEquivalenceTest.cpp
Index: unittests/AST/StructuralEquivalenceTest.cpp
===================================================================
--- unittests/AST/StructuralEquivalenceTest.cpp
+++ unittests/AST/StructuralEquivalenceTest.cpp
@@ -802,6 +802,25 @@
EXPECT_FALSE(testStructuralMatch(t));
}
+struct StructuralEquivalenceTemplateTest : StructuralEquivalenceTest {};
+
+TEST_F(StructuralEquivalenceTemplateTest, ExactlySameTemplates) {
+ auto t = makeNamedDecls("template <class T> struct foo;",
+ "template <class T> struct foo;", Lang_CXX);
+ EXPECT_TRUE(testStructuralMatch(t));
+}
+
+TEST_F(StructuralEquivalenceTemplateTest, DifferentTemplateArgName) {
+ auto t = makeNamedDecls("template <class T> struct foo;",
+ "template <class U> struct foo;", Lang_CXX);
+ EXPECT_TRUE(testStructuralMatch(t));
+}
+
+TEST_F(StructuralEquivalenceTemplateTest, DifferentTemplateArgKind) {
+ auto t = makeNamedDecls("template <class T> struct foo;",
+ "template <int T> struct foo;", Lang_CXX);
+ EXPECT_FALSE(testStructuralMatch(t));
+}
} // end namespace ast_matchers
} // end namespace clang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57235.183525.patch
Type: text/x-patch
Size: 1159 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190125/638cf5f5/attachment.bin>
More information about the cfe-commits
mailing list