<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/109475>109475</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Error on out-of-line definition with constraints of template specialization
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
steve-downey
</td>
</tr>
</table>
<pre>
Showed up during work on optional<T&> and making definitions out of line to produce the synopsis.
Reduced examplar:
```C++
#include <type_traits>
template <typename T>
struct X {};
template <class T>
struct X<T&> {
template <typename U>
requires(!(std::is_same_v<std::remove_cvref_t<U>, X>))
X(U&& u);
};
template <typename T>
template <typename U>
requires(!(std::is_same_v<std::remove_cvref_t<U>, X<T&>>))
X<T&>::X(U&& u) {}
```
https://compiler-explorer.com/z/v5Y14oTb8
The general converting constructor needs to be constrained out so as not to conflict with, or be a better match than, the copy constructor.
<source>:16:8: error: out-of-line definition of 'X<type-parameter-0-0 &>' does not match any declaration in 'X<type-parameter-0-0 &>'
16 | X<T&>::X(U&& u) {}
| ^
1 error generated.
Compiler returned: 1
I know there have been a number of issues in this area, but kept finding ones that were fixed or seemed different.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy8VU1v4zYQ_TX0ZWBDpizLOuiQeGOg1zYLpCeDIkcWG4lUyZEd768vRtI6TpB-nCoQCcDhPM6b94ZWMdqTQyxF9iiybws1UONDGQnPuDT-4vC6qLy5lr81_oIGhh7MEKw7wcWHV_AOfE_WO9WKdP8s5FakT6CcgU698imDtXWWT0TwA4GvobUOgTz0wZtBI1CDEK_O99HGlUi-ieRh-vsrctwAvqmub1UQ6RwQ22RaeyEfeU27MrVOt4NBEOmerj0eKShLUaRP97CEjEa3U051CM-3Q5HCoAleQOSPIv8m0se_S9ativGLzLtOMMYYgy9v_X7LhYB_DjZgFHIn5FrIXSTDhNMHG49RdXg8i3R_2wzY-TMe9TlgfSSR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