Issue 61420
Summary `cppcoreguidelines-rvalue-reference-param-not-moved` not reported for templated method
Labels new issue
Assignees
Reporter firewave
    ```cpp
#include <string>

class C
{
public:
    template<typename T>
    void str(T&& s) { // no warning
        mStr = s;
    }

    void str2(std::string&& s) { // warning
        mStr = s;
    }
private:
    std::string mStr;
};

void f()
{
    C c;
    c.str("");
 c.str2("");
}
```

```
<source>:11:29: warning: rvalue reference parameter 's' is never moved from inside the function body [cppcoreguidelines-rvalue-reference-param-not-moved]
    void str2(std::string&& s) {
``` ^

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

Reply via email to