<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/55143>55143</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-tidy: bugprone-exception-escape: explicitly defined move constructor may not thhrow
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
igagis
</td>
</tr>
</table>
<pre>
# to reproduce
Create `main.cpp` file with following contents
```cpp
class A{
public:
A(A&&){
throw 10;
}
A& operator=(A&&){
throw 20;
return *this;
}
};
class B{
public:
B(B&&)noexcept(false){
throw 10;
}
B& operator=(B&&)noexcept(false){
throw 20;
return *this;
}
};
```
Then run `clang-tidy` as follows:
```console
clang-tidy main.cpp --checks="bugprone-exception-escape" --
```
# Expected result
No warnings generated
# Actual result
Following warnings generated:
```console
ivan@igagis:~/prj/test$ clang-tidy main.cpp --checks="bugprone-exception-escape" --
4 warnings generated.
/home/ivan/prj/test/main.cpp:3:2: warning: an exception may be thrown in function 'A' which should not throw exceptions [bugprone-exception-escape]
A(A&&){
^
/home/ivan/prj/test/main.cpp:7:5: warning: an exception may be thrown in function 'operator=' which should not throw exceptions [bugprone-exception-escape]
A& operator=(A&&){
^
/home/ivan/prj/test/main.cpp:15:2: warning: an exception may be thrown in function 'B' which should not throw exceptions [bugprone-exception-escape]
B(B&&)noexcept(false){
^
/home/ivan/prj/test/main.cpp:19:5: warning: an exception may be thrown in function 'operator=' which should not throw exceptions [bugprone-exception-escape]
B& operator=(B&&)noexcept(false){
^
```
# version
```console
ivan@igagis:~/prj/test$ clang-tidy --version
LLVM (http://llvm.org/):
LLVM version 11.0.1
Optimized build.
Default target: x86_64-pc-linux-gnu
Host CPU: haswell
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzNVkuTmzgQ_jX40oVLvPw4cLAz49pDNslhd68pIdqgRJYoSYw9-fXbYIPtrGc2M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