| Issue |
56026
|
| Summary |
clang-tidy: false positive from `hicpp-noexcept-move` for templated, defaulted move constructors
|
| Labels |
|
| Assignees |
|
| Reporter |
AMS21
|
Given the following source code:
```cpp
#include <type_traits>
struct A {
A(A&&) = default;
};
template <typename T1>
struct B {
B(B&&) = default;
};
static_assert(std::is_nothrow_move_constructible<A>::value, "");
static_assert(std::is_nothrow_move_constructible<B<int>>::value, "");
```
Running `clang-tidy -checks=hicpp-noexcept-move`
We get the following output:
```
<source>:9:5: warning: move constructors should be marked noexcept [hicpp-noexcept-move]
B(B&&) = default;
^
noexcept
1 warning generated.
```
Although the move constructor is automatically noexcept due to it being defaulted just like struct `A` and otherwise the static_assert would fail on line 13.
[godbolt link](https://godbolt.org/z/nnjrTPqhj)
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs