Issue 241229
Summary Clang accepts definition of a local class member function outside the class
Labels clang
Assignees
Reporter Fedr
    Clang accepts this program (https://godbolt.org/z/9oTzG9aGf):
```cpp
auto f() {
 struct A {
        A();
        void g();
    };
    return A{};
}

using A = decltype(f());

A::A() = default;
void A::g() {}
```
[[class.local]/2](https://eel.is/c++draft/class.local#2): "Member functions of a local class shall be defined within their class definition, if they are defined at all." See also https://stackoverflow.com/q/79808341/7325599, [CWG2890](https://cplusplus.github.io/CWG/issues/2890.html) and #193472, which fixed the same issue for nested classes only.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to