<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/97532>97532</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [c++11] clang allows questionable CTAD for template base of derived class with default argument
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          Rush10233
      </td>
    </tr>
</table>

<pre>
    The following code is accepted by clang but rejected by GCC,MSVC and ICC with the option of `-std=c++11`:

```c++
template<typename,typename=int> struct Base { };

struct Derived : Base<void> { };

template<template<typename> class TT>
void func (TT<void>) { }

int main () {
  func (Derived { });
}
```
[https://timsong-cpp.github.io/cppwp/std11/temp.deduct.call#4](https://timsong-cpp.github.io/cppwp/std11/temp.deduct.call#4) says that "If P is a class and P has the form simple-template-id, then the transformed A can be a derived class of the deduced A." So the class `Derived` passed in line 9 can be deduced to its base type.

But the parameter requested by `func` is a template class with 1 argument, while class `Base` has 2(including 1 with default value), which seems incompatible.

It's interesting that gcc accepts that code under `-std=c++20`, but other compilers don't. It seems that  more standard docs need to be consulted.

[https://godbolt.org/z/G7fenEsYY](https://godbolt.org/z/G7fenEsYY)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVc1u4zgTfJr2pWFDatmWddAhluNBDh8w-CZYYI4U2bK4oEitSCXIPv2ClJxkfrCnBQz_UMXqYrO6LLzXN8tcw-EMh8tGzKF3U_3_2fd5RkWxaZ16q597xs4Z4161vaF0ilF7FFLyGFhh-4bSCHvDdg448Z8s19UvTQPU_O_bHw0Kq_CpafBVhx5Dz-jGoJ1F1yEcs60PCoqLBDoDnfMcjhkUD5BdILu_H7PltWKW1cDDaERgKJrwNrIVAwN9fC0u2gYoHtGHaZYBz8IzQnlGKC9QnD_zr4gLT_qFFULxkNBQNC9Oq8jx-32fFfxGTPEYW-M9Pj9D8bh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