| Issue |
109475
|
| Summary |
Error on out-of-line definition with constraints of template specialization
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
steve-downey
|
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.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs