[clang] [clang] Track source deduction guide for alias template deduction guides (PR #123875)
Shafik Yaghmour via cfe-commits
cfe-commits at lists.llvm.org
Wed Jan 22 20:34:42 PST 2025
================
@@ -8147,6 +8149,26 @@ TEST_P(ImportFunctions, CTADWithLocalTypedef) {
ASSERT_TRUE(ToD);
}
+TEST_P(ImportFunctions, CTADAliasTemplate) {
+ Decl *TU = getTuDecl(
+ R"(
+ template <typename T> struct A {
+ A(T);
+ };
+ template<typename T>
+ using B = A<T>;
+ B b{(int)0};
+ )",
+ Lang_CXX20, "input.cc");
+ auto *FromD = FirstDeclMatcher<CXXDeductionGuideDecl>().match(
+ TU, cxxDeductionGuideDecl(hasParameter(0, hasType(asString("int")))));
+ auto *ToD = Import(FromD, Lang_CXX20);
+ ASSERT_TRUE(ToD);
+ EXPECT_TRUE(ToD->getSourceDeductionGuideKind() ==
+ CXXDeductionGuideDecl::SourceDeductionGuideKind::Alias);
----------------
shafik wrote:
Can we also get a test that covers the `None` case to ensure we are serializing and deserializing correctly for both.
Testing should if possible always cover all path, otherwise this opens us to undetected regressions in the untested paths.
https://github.com/llvm/llvm-project/pull/123875
More information about the cfe-commits
mailing list