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

    <tr>
        <th>Summary</th>
        <td>
            Clang 20+ dependent type,value Template-Template resolution differs from GCC,MSVC,Clang10-19
        </td>
    </tr>

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

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

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

<pre>
    The following C++-20 code produces different (seemingly incorrect) template resolution between Clang 20 and GCC,MSVC,Clang10-19:

```c++
#include <stdio.h>

template <typename T, auto value>
struct different_type_value_templ
{
};

template <typename T, T value>
struct same_type_value_templ
{
};

template <typename... TArgs>
struct resolve;

template <typename T>
void resolve_fallback()
{
 puts("called with 'T' (fallback)");
}

template <template <typename T1, auto V2> typename T, typename T1, auto V2>
struct resolve<T<T1, V2>>
{
 static void handle()
    {
        puts("called with 'T<T1, V2>'");
 }
};

template <typename T>
concept can_handle_type_resolve = requires () {
    resolve<T>::handle();
};

template <typename T>
void do_resolve()
{
    if constexpr (can_handle_type_resolve<T>)
 resolve<T>::handle();
    else
        resolve_fallback<T>();
}

int main()
{
    // consistent:
    do_resolve<different_type_value_templ<int, 1>>();
    do_resolve<different_type_value_templ<bool, false>>();

    // inconsistent:
    do_resolve<same_type_value_templ<int, 1>>();
 do_resolve<same_type_value_templ<bool, false>>();
}
```

Should seemingly produce (as does MSVC, GCC, Clang 10-19.1)
```
called with 'T<T1, V2>'
called with 'T<T1, V2>'
called with 'T<T1, V2>'
called with 'T<T1, V2>'
```

but produces the following on clang 20.1 (w/ `-std=c++20`)
```
called with 'T<T1, V2>'
called with 'T<T1, V2>'
called with 'T' (fallback)
called with 'T' (fallback)
```

See: https://godbolt.org/z/o445cKv4c
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy8VkFv6ygX_TVkcxXLBqe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