[all-commits] [llvm/llvm-project] 7bb90d: [clang] Finish implementation of P0522
Matheus Izvekov via All-commits
all-commits at lists.llvm.org
Thu Jan 23 07:48:39 PST 2025
Branch: refs/heads/users/mizvekov/clang-unified-p0522-cwg2398-changes
Home: https://github.com/llvm/llvm-project
Commit: 7bb90d12b890abc3c2535d1ceca62021b9d228c1
https://github.com/llvm/llvm-project/commit/7bb90d12b890abc3c2535d1ceca62021b9d228c1
Author: Matheus Izvekov <mizvekov at gmail.com>
Date: 2025-01-23 (Thu, 23 Jan 2025)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Basic/DiagnosticSemaKinds.td
M clang/include/clang/Sema/Sema.h
M clang/lib/Frontend/FrontendActions.cpp
M clang/lib/Sema/SemaTemplate.cpp
M clang/lib/Sema/SemaTemplateDeduction.cpp
M clang/lib/Sema/SemaTemplateInstantiate.cpp
M clang/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp
M clang/test/CXX/temp/temp.param/p12.cpp
M clang/test/Modules/cxx-templates.cpp
M clang/test/SemaCXX/make_integer_seq.cpp
M clang/test/SemaTemplate/cwg2398.cpp
M clang/test/SemaTemplate/temp_arg_nontype.cpp
M clang/test/SemaTemplate/temp_arg_template.cpp
M clang/test/SemaTemplate/temp_arg_template_p0522.cpp
M clang/test/Templight/templight-empty-entries-fix.cpp
M clang/test/Templight/templight-prior-template-arg.cpp
Log Message:
-----------
[clang] Finish implementation of P0522
This finishes the clang implementation of P0522, getting rid
of the fallback to the old, pre-P0522 rules.
Before this patch, when partial ordering template template parameters,
we would perform, in order:
* If the old rules would match, we would accept it. Otherwise, don't
generate diagnostics yet.
* If the new rules would match, just accept it. Otherwise, don't
generate any diagnostics yet again.
* Apply the old rules again, this time with diagnostics.
This situation was far from ideal, as we would sometimes:
* Accept some things we shouldn't.
* Reject some things we shouldn't.
* Only diagnose rejection in terms of the old rules.
With this patch, we apply the P0522 rules throughout.
This needed to extend template argument deduction in order
to accept the historial rule for TTP matching pack parameter to non-pack
arguments.
This change also makes us accept some combinations of historical and P0522
allowances we wouldn't before.
It also fixes a bunch of bugs that were documented in the test suite,
which I am not sure there are issues already created for them.
This causes a lot of changes to the way these failures are diagnosed,
with related test suite churn.
The problem here is that the old rules were very simple and
non-recursive, making it easy to provide customized diagnostics,
and to keep them consistent with each other.
The new rules are a lot more complex and rely on template argument
deduction, substitutions, and they are recursive.
The approach taken here is to mostly rely on existing diagnostics,
and create a new instantiation context that keeps track of this context.
So for example when a substitution failure occurs, we use the error
produced there unmodified, and just attach notes to it explaining
that it occurred in the context of partial ordering this template
argument against that template parameter.
This diverges from the old diagnostics, which would lead with an
error pointing to the template argument, explain the problem
in subsequent notes, and produce a final note pointing to the parameter.
Commit: 159aacbc6c4bd3f85ff6ca2ce6d24d37eb270dcf
https://github.com/llvm/llvm-project/commit/159aacbc6c4bd3f85ff6ca2ce6d24d37eb270dcf
Author: Matheus Izvekov <mizvekov at gmail.com>
Date: 2025-01-23 (Thu, 23 Jan 2025)
Changed paths:
M clang/docs/ReleaseNotes.rst
M clang/include/clang/Sema/Sema.h
M clang/include/clang/Sema/TemplateDeduction.h
M clang/lib/Sema/SemaLookup.cpp
M clang/lib/Sema/SemaTemplate.cpp
M clang/lib/Sema/SemaTemplateDeduction.cpp
M clang/lib/Sema/SemaTemplateInstantiate.cpp
M clang/test/SemaTemplate/cwg2398.cpp
Log Message:
-----------
[clang] CWG2398: improve overload resolution backwards compat
With this change, we discriminate if the primary template and which partial
specializations would have participated in overload resolution prior to
P0522 changes.
We collect those in an initial set. If this set is not empty, or the
primary template would have matched, we proceed with this set as the
candidates for overload resolution.
Otherwise, we build a new overload set with everything else, and proceed
as usual.
Commit: 358b4a454c67407045171857e48628d97fe37f50
https://github.com/llvm/llvm-project/commit/358b4a454c67407045171857e48628d97fe37f50
Author: Matheus Izvekov <mizvekov at gmail.com>
Date: 2025-01-23 (Thu, 23 Jan 2025)
Changed paths:
M clang/include/clang/Sema/Overload.h
M clang/include/clang/Sema/Sema.h
M clang/lib/Sema/SemaLookup.cpp
M clang/lib/Sema/SemaOverload.cpp
M clang/lib/Sema/SemaTemplate.cpp
M clang/lib/Sema/SemaTemplateDeduction.cpp
M clang/test/SemaTemplate/cwg2398.cpp
Log Message:
-----------
[clang] Implement TTP 'reversed' pack matching for deduced function template calls.
Clang previously missed implementing P0522 pack matching
for deduced function template calls.
Commit: 3731183f95127312538333042fb65c2de1d2aeb5
https://github.com/llvm/llvm-project/commit/3731183f95127312538333042fb65c2de1d2aeb5
Author: Matheus Izvekov <mizvekov at gmail.com>
Date: 2025-01-23 (Thu, 23 Jan 2025)
Changed paths:
M clang/lib/Sema/SemaTemplate.cpp
M clang/lib/Sema/SemaTemplateDeduction.cpp
M clang/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp
M clang/test/SemaTemplate/cwg2398.cpp
M clang/test/SemaTemplate/temp_arg_template_p0522.cpp
Log Message:
-----------
[clang] Changes to template argument list checking
Implement some missing changes to support checking of argument-side template parameter
packs matching parameter-side non-pack parameters, which are required to
support non-exact matches in these cases, and applies appropriate
conversions which help deducing NTTPs of placeholder types.
Compare: https://github.com/llvm/llvm-project/compare/7bb90d12b890%5E...3731183f9512
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list