[clang] [clang] check deduction consistency when partial ordering function templates (PR #100692)

Matheus Izvekov via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 17 22:22:52 PDT 2024


mizvekov wrote:

Regarding test case 2, that further reduces to:
```C++
template <class, int Rows_, int = (Rows_)> class Q {};

template <int rows> void F(Q<double, rows, rows>);
template <class Scalar, int Rows> void F(Q<Scalar, Rows>) = delete;

void test() {
  F(Q<double, 1>());
}
```

The problem is that we consider the parenthesized expression significant in terms of forming a distinct type.
You can see the problem goes away if you remove that parenthesis in the default argument for Q.

I believe the parenthesis should not be significant in this case, and there is also some divergence between GCC and Clang in this area.
I am asking the core reflector for clarification here.

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


More information about the cfe-commits mailing list