<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/91650>91650</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Identical return type considered different in redeclaration with trailing return type and enough templates
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
davidstone
</td>
</tr>
</table>
<pre>
The following valid code:
```c++
template<bool>
struct enable_if {
using type = void;
};
template<typename>
struct trait {
static constexpr bool value = false;
};
template<typename T>
struct s {
typename enable_if<trait<T>::value>::type assign();
};
template<typename T>
auto s<T>::assign() -> typename enable_if<trait<T>::value>::type {
}
```
is rejected by clang with
```console
<source>:17:12: error: return type of out-of-line definition of 's::assign' differs from that in the declaration
17 | auto s<T>::assign() -> typename enable_if<trait<T>::value>::type {
| ^
<source>:13:45: note: previous declaration is here
13 | typename enable_if<trait<T>::value>::type assign();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
1 error generated.
Compiler returned: 1
```
This occurred on clang trunk very recently, so it's not yet showing up on Godbolt: https://godbolt.org/z/KTE7dvcjd
@sdkrystian: It was introduced by 62b5b61f436add042d8729dc9837d055613180d9.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VcuO6zYM_RplQySwJT_ihReZZFJcdDv7QpboWPcqUiDRmaaLfnshOzN5YFD0hQqGY0shDw95SMsYzcEhtqx8YeVuIUcafGi1PBsdyTtcdF5f2rcBoffW-nfjDnCW1mhQXiMTG5btWPZxr7L5Uoy_pGvaJTyerCRkYtt5b5l4nfcjhVERoJOdxV9MD6x--fDWjDEh0eWEwMQOzt5oJj6O693t-RkimTh5xGcYCtLQA0QkSUaB8i4S_noKkKJL5MYZs5c24t8Dhbdn2HiDhM9_fVJOpikuJraTpdgwsZki-HybUjCXifE1480_jkiO5CE-QN37hSUTr_8ixltq692THO5jNBECfkdFqKG7gLLSHeDd0PC1kLyL3uJ1V2yjH4O6Aud1unEmNoAh-JAeAtIY3Kwb34Mfaen7pTUOQWNvnCHjXTphvI6POahBm77HEKEP_gg0SALjgIZkqqwMMtleSwmQ18DqLfxfSYVpJcS7xcrXrzMjmNgUZUqI80kOGzgFPBs_xnsuYCIMGPDGSVwR_mOl3oL__a-uG7d8ri4c0GGQhHo172_98WQshmvNUSea-Z8o720wEbxSYwiowbur9iiM7gecMVwgoEJH9sL4FqIHQ0klKYVwQYI4zONvPCXjn7zuvKUEOhCdJjHxPeP7w3yw8uHA-P43xvc_v73W-qy-6weJF1nUP8IlkpEueflG8C4jGEfB61HN7VHxruyqvC9EJbXOCq7XNW-0atai1llZVrnI15luVgvdCt2IRi6wzeu85OtynYvF0GIh67pSCtd1UclK9xx1hSXP-Tq95wvT8owXWZk1PMurUqywxqbIul41WZn3mrMiw6M0dmXt-ZhoLUyMI7ZNXpXZwsoObZy-H5w7fIfpkHGePiehTTbLbjxEVmTWRIo3L2TIYvtNoyOjpH3o3dT3RmMq1NyV6KZuDHiv3zQ2psFuU13u7aXTgM6PhwE-hmJcjMG2T7UyNIzdSvkj4_sU2PVneQo-zSjG9xOdyPh-ovtHAAAA___3QDQo">