Issue 52835
Summary [clang] False Positive in Wunneded-member-function?
Labels clang, clang:frontend
Assignees
Reporter carlosgalvezp
    The following code triggers a potential false positive in `Wunneeded-member-function`

```
namespace 
{
struct Foo
{
    Foo() = default;
    
    Foo(Foo const&) = delete;
    Foo& operator=(Foo const&) = delete;

    Foo(Foo&&) = default;
    Foo& operator=(Foo&&) = default;
};
}

void f(Foo f) {}


int main()
{
    f(Foo());
}
```
```
source>:5:5: warning: member function 'Foo' is not needed and will not be emitted [-Wunneeded-member-function]
    Foo() = default;
    ^
```

If I remove the constructor, the code won't compile.

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

Reply via email to