[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 30 12:21:03 PDT 2024


mizvekov wrote:

Reduction:

```
template <class> struct __promote {
  using type = float;
};
template <class> class complex {};

template <class _Tp>
complex<_Tp> pow(const complex<_Tp> &) {};

template <class _Tp>
complex<typename __promote<_Tp>::type> pow(_Tp) = delete;

using F0 = complex<float> (*)(const complex<float> &);
F0 ptr{pow};
```

This is the same as the enable_if consistency check problem, only applied to the return type of a function pointer.
We only so far applied this fix for function calls, but it would be easy to extend this to cover return type and function parameters in the other deduction contexts: In this example, since we haven't deduced any template parameters from the return type, we shouldn't perform consistency check on it.

https://github.com/llvm/llvm-project/pull/100692


More information about the cfe-commits mailing list