Issue 56442
Summary 'out-of-line definition' when defining member function enabled with concept outside class
Labels new issue
Assignees
Reporter alemuntoni
    When building the following code with Clang 14.0.0 (flag `-std=c++20`):

```
template<typename T>
concept MyConcept = std::is_integral<T>::value; //could be anything...

template<typename T>
class F {
public:
    void foo() requires MyConcept<F>;
};

template<typename T>
void F<T>::foo() requires MyConcept<F<T>>
{
    //long implementation...
}
```

I get the following error:

```
main.cpp:38: error: out-of-line definition of 'foo' does not match any declaration in 'F<T>'
main.cpp:38:12: error: out-of-line definition of 'foo' does not match any declaration in 'F<T>'
void F<T>::foo() requires MyConcept<F<T>>
           ^~~
main.cpp:34:7: note: member declaration nearly matches
        void foo() requires MyConcept<F>;
             ^
```

See also https://stackoverflow.com/questions/72897153/outside-class-definition-of-member-function-enabled-with-concept?noredirect=1#comment128757341_72897153
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to