-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang] Track source deduction guide for alias template deduction guides #123875
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
ff55e99
d5499b3
918fef4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8105,6 +8105,7 @@ TEST_P(ImportFunctions, CTADImplicit) { | |
| auto *ToD = Import(FromD, Lang_CXX17); | ||
| ASSERT_TRUE(ToD); | ||
| EXPECT_EQ(ToD->getDeductionCandidateKind(), DeductionCandidate::Copy); | ||
| EXPECT_EQ(ToD->getSourceDeductionGuide(), nullptr); | ||
| // Check that the deduced class template is also imported. | ||
| EXPECT_TRUE(findFromTU(FromD)->Importer->GetAlreadyImportedOrNull( | ||
| FromD->getDeducedTemplate())); | ||
|
|
@@ -8129,6 +8130,7 @@ TEST_P(ImportFunctions, CTADUserDefinedExplicit) { | |
| ASSERT_TRUE(ToD); | ||
| EXPECT_FALSE(FromD->isImplicit()); | ||
| EXPECT_TRUE(ToD->isExplicit()); | ||
| EXPECT_EQ(ToD->getSourceDeductionGuide(), nullptr); | ||
| } | ||
|
|
||
| TEST_P(ImportFunctions, CTADWithLocalTypedef) { | ||
|
|
@@ -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); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also get a test that covers the Testing should if possible always cover all path, otherwise this opens us to undetected regressions in the untested paths.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done, I was already testing |
||
| EXPECT_TRUE(ToD->getSourceDeductionGuide()); | ||
| } | ||
|
|
||
| TEST_P(ImportFunctions, ParmVarDeclDeclContext) { | ||
| constexpr auto FromTUCode = R"( | ||
| void f(int P); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add comments for all the nullptr arguments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More specifically bugprone-argument-comment comments,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done