ahatanak wrote:

I think this change can confuse users in some cases.

```
class Error {
public:
  Error() = default;
  Error(Error &&);
  Error &operator=(Error &&);
  explicit operator bool() const;
};

Error getError();

Error foo() {
  if (Error e = getError(1)) {
    return e;
  }
  return Error();
}
```

When the code above is compiled, clang complains that the implicitly-deleted 
copy constructor of 'Error' is called. This makes users wonder why `return e` 
isn't eligible for copy elision.

I wonder whether it would be better to check that `VD`'s type is incomplete 
rather than calling `containsErrors`.

https://github.com/llvm/llvm-project/pull/79788
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to