Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
07e8828
[Clang][WIP][RFC] Bypass TAD during overload resolution if a perfect …
cor3ntin Mar 27, 2025
d35cfbb
avoid comparing types
cor3ntin Mar 29, 2025
297109c
Fix logic
cor3ntin Mar 29, 2025
f1b0454
optimize
cor3ntin Mar 29, 2025
31ad232
optimize again
cor3ntin Mar 29, 2025
f57291b
Cleanups, fix tests
cor3ntin Mar 31, 2025
bade63f
Fix templight test
cor3ntin Mar 31, 2025
a134656
format
cor3ntin Mar 31, 2025
057b935
do not skip templates when initializing by constructors as that might…
cor3ntin Mar 31, 2025
721f26c
move and document the special handling of implicit object member func…
cor3ntin Mar 31, 2025
a21bc4d
Fix typos and cuda tests
cor3ntin Mar 31, 2025
b205be1
remove redundant check
cor3ntin Mar 31, 2025
af22b19
More code simplification
cor3ntin Apr 1, 2025
42e8795
fix cuda, add comments
cor3ntin Apr 1, 2025
03c157a
add tests
cor3ntin Apr 1, 2025
0709939
* Fix handling of explicit specifiers
cor3ntin Apr 1, 2025
a02299e
slab allocate template candidates
cor3ntin Apr 3, 2025
8ee938c
fix rvalue to lvalue binding
cor3ntin Apr 3, 2025
bcf08f5
Disable resolution by perfect match when
cor3ntin Apr 3, 2025
8aee255
address Erich's, format, add release notes
cor3ntin Apr 15, 2025
6edcb65
address more of Erich's feedback
cor3ntin Apr 15, 2025
7b0c9c6
Clarify changelog
cor3ntin Apr 15, 2025
c621548
fix assertion
cor3ntin Apr 15, 2025
cfecf5a
cleanups
cor3ntin Apr 16, 2025
8004549
fix assertion
cor3ntin Apr 16, 2025
14e0515
Cleaner approach
cor3ntin Apr 16, 2025
d4db7e6
Add comment
cor3ntin Apr 16, 2025
02db83a
Add asserts
cor3ntin Apr 16, 2025
17cbd62
fix missplaced assert
cor3ntin Apr 16, 2025
b1ce5e7
typo
cor3ntin Apr 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions clang/include/clang/Sema/Overload.h
Original file line number Diff line number Diff line change
Expand Up @@ -1005,14 +1005,14 @@ class Sema;

// An overload is a perfect match if the conversion
// sequences for each argument are perfect.
bool isPerfectMatch(const ASTContext &Ctx) const {
bool isPerfectMatch(const ASTContext &Ctx, bool ForConversion) const {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vastly prefer this take the Kind, then line 1015 describe why conversions are ok when CSK_InitByUserDefinedConversion.

if (!Viable)
return false;
for (const auto &C : Conversions) {
if (!C.isInitialized() || !C.isPerfect(Ctx))
return false;
}
if (isa_and_nonnull<CXXConversionDecl>(Function))
if (ForConversion && isa_and_nonnull<CXXConversionDecl>(Function))
return FinalConversion.isPerfect(Ctx);
return true;
}
Expand Down
3 changes: 2 additions & 1 deletion clang/lib/Sema/SemaOverload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11229,7 +11229,8 @@ void OverloadCandidateSet::PerfectViableFunction(
Best = end();
for (auto It = begin(); It != end(); ++It) {

if (!It->isPerfectMatch(S.getASTContext()))
if (!It->isPerfectMatch(S.getASTContext(),
Kind == CSK_InitByUserDefinedConversion))
continue;

// We found a suitable conversion function
Expand Down
15 changes: 15 additions & 0 deletions clang/test/SemaCXX/overload-resolution-deferred-templates.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,18 @@ void h(short n) { f(n); }
}

#endif

template<typename ...Ts>
struct t1 {
};
struct t6 {
template<typename T = int>
operator t1<float>() {
return {};
}
};

int main() {
t6 v6;
v6.operator t1<float>();
}
Loading