[clang] [clang] check deduction consistency when partial ordering function templates (PR #100692)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 23 18:19:49 PDT 2024
================
@@ -859,8 +861,10 @@ class PackDeductionScope {
// by this pack expansion, then clear out the deduction.
DeducedFromEarlierParameter = !Deduced[Index].isNull();
DeducedPack Pack(Index);
- Pack.Saved = Deduced[Index];
- Deduced[Index] = TemplateArgument();
+ if (!FinishingDeduction) {
+ Pack.Saved = Deduced[Index];
+ Deduced[Index] = TemplateArgument();
+ }
----------------
mizvekov wrote:
Note we aren't doing any pack specific changes here, this is just for better code reuse.
We have tons of tests in the test suite with partial ordering of function templates which involve packs.
One example I can give offhand (because I mentioned to @zygoloid on another thread) is 'temp_deduct_type_example3' in `CXX/CXX/drs/cwg6xx.cpp`:
```C++
template<class T, class... U> void f(T*, U...){}
template<class T> void f(T){}
template void f(int*);
```
Do you have something in mind which might be missing?
https://github.com/llvm/llvm-project/pull/100692
More information about the cfe-commits
mailing list