[clang] [clang] Track source deduction guide for alias template deduction guides (PR #123875)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 25 18:00:20 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);
----------------
antangelo wrote:
Done, I was already testing `getSourceDeductionGuide` for the `nulltptr` case so I have now added assertions for `getSourceDeductionGuideKind` being `None`.
https://github.com/llvm/llvm-project/pull/123875
More information about the cfe-commits
mailing list