[clang] [clang-tools-extra] [clang] Implement CWG2398 provisional TTP matching to class templates (PR #92855)
Matheus Izvekov via cfe-commits
cfe-commits at lists.llvm.org
Thu May 23 18:20:00 PDT 2024
mizvekov wrote:
I figured a reproducer based on your hints:
```C++
template<class T, class U> struct A {};
template<template<class> class TT> auto f(TT<int> a) { return a; }
A<int, float> v1;
A<int, double> v2;
using X = decltype(f(v1));
using Y = decltype(f(v2));
```
Fails with:
```
t.cc:9:20: error: no matching function for call to 'f'
9 | using Y = decltype(f(v2));
| ^
t.cc:3:41: note: candidate template ignored: deduced type 'A<[...], (default) float>' of 1st parameter does not match adjusted type 'A<[...], double>' of argument [with TT = A]
3 | template<template<class> class TT> auto f(TT<int> a) { return a; }
| ^
```
This shows we are not properly canonicalizing the synthesized template declaration.
The problem does not show up with class template partial specializations due to a pre-existing issue, but otherwise this was an oversight on my part.
No need to keep reducing on your end, I already have enough to go with.
https://github.com/llvm/llvm-project/pull/92855
More information about the cfe-commits
mailing list