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LVm2gl9-D2LYa9o0Xv5S_cDjmM>53224</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
C++ compiler should forbid throw move-only type
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
fsb4000
</td>
</tr>
</table>
<pre>
Hello.
We were reported a bug: https://github.com/microsoft/STL/issues/2466
But we think that the report is wrong.
```
#include <exception>
#include <string>
using namespace std;
class C {
public:
C() = default;
C(const C&) = delete;
C& operator=(const C&) = delete;
C(C&&) = default;
C& operator=(C&&) = default;
private:
string m;
};
int main() {
exception_ptr eptr;
try {
throw C();
} catch (const C&) {
eptr = std::current_exception();
}
try {
rethrow_exception(eptr);
} catch (const C&) {
}
}
```
https://godbolt.org/z/q3cYGfneP
We think that the compiler should reject the program because the program violates [except.throw]/5: https://eel.is/c++draft/except.throw#5
>When the thrown object is a class object, the constructor selected for the copy-initialization as well as the constructor selected for a copy-initialization considering the thrown object as an lvalue shall be non-deleted and accessible, even if the copy/move operation is elided
We decided to notify developers of other C++ compilers too.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydVUuPmzAQ_jVwGSUiEEhy4LDJ7raHHiq10qqnlbGH4NaxqW2yzf76jiHvbLdVJQO25_XNk8qIXfkRlTLjKLmPkrsnhBe0CBZbYz0KYFB16yi7g8b71tEmSh9praVvumrMzYYOG8mtcab2tP_y9RO9pXMdOtqk06IYNC87T6rBN1L_oDfz9DrYAengxRq93qPYv4tkv4ZjmknNVScQomyFvzi2XhodZQ9v0Z23Uq-PxM7RCTTboGsZR3BeRNny3BpXzDlYQTTbX7ddpSQPHvdHgFWUzqN0QdrvQWDNOuWPOgYqN9r5sCtOfAo9XrIVYFq0zBtLHP8sNR8YincRXKv-i8zeUSu3LJg7ejoEDzYnxtn9lZDUHjZM6kNMZkcYx8w8t94Cbe0ZRm9357x00VjzcgjtGSNZBM48b-A2QufyQX_vW5_RO1q8sxa1fz5VyBu6_4jHYo_oQrr34T_QHe2cNpclfdVTRlRG-bGxazq90vMz498-1Bo_n0f-6aaJqAtbqdCCa0ynBPnwHflAaq1ZW7aBCjnrHF7cbaVRlHcHUb4c3B33vkc5lc5jftv0iGosQ1fzKF3SEpb1PX8hnGb5RRNnD08N6t5wz6DBVD086nkGQ9cNN1G62rtD8bQdpyoGR53Awxyq6TAQ291IauklU_KVhQwBo-lBMyx835Vnb0oHdimwr_hblKSTaVBbpjqaGg0jMxWCNno0NClNSE0P5-icrBQGJ3BLDsv6iDeMSLPFfW8Gm-Q7KjIqrhIrkIdb8IZMeFnv6GaLKghSlGowpNKGUgvhP-ad3DZmHIsyE4tswWIvvcLymutQHRSJSop94wVcI6PVDvyuxbizqnxn0Cu1PXxGVEVD0k7DPs_SdBo35QyrOa-KapELLkSS00-gntRYLDDh1ZxNYsUqVK6kuqNai2WZJmmaTCZFMkuKNBkXGZ_ks3pW5MlssUhFNE2QZo0aB8OhPWJb9hjo1-SIqKTz7kSkipJrjXjQzzrfGFvWrpomSRL3cMse6287QSRp">