-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default non-throw move ctor with std::unordered_map member is not move constructible #165
Comments
FYI, why absl::flat_hash_map is used? Because this code snippet is reduce from a complex form of library code, and abseil lib is included. It compiles with GCC but not MSVC. MSVC keeps complaining copy ctor is deleted when you have something like |
That is not Standard-mandated behavior. From the class template synopsis in [unord.map.overview], neither the default constructor nor move constructor is depicted as having a noexcept-specifier. Notably our implementation uses separately-allocated sentinel nodes which necessitates an allocation in both the default constructor and move constructor, so they cannot be |
OK, after reading the C++17 standard.
Still hope you guys can improve the error message. |
There isn't much of anything the STL can do about diagnostics that compilers choose to emit for code unrelated to the STL. I suggest that you file a suggestion at Developer Community about improving diagnostics for this case. |
Command-line test case
STL version (git commit or Visual Studio version):
Minimal reproducible test case:
compilation command:
Expected behavior
In the above case,
std::is_move_constructible
andstd::is_nothrow_move_constructible
should betrue
, aka, only two static_assert fail, line 22, line 25.Additional context
abseil
'sflat_hash_map
, it is indeed move constructible and nothrow move constructible.MyStruct(MyStruct&&) = default;
, it is indeed move constructible but NOT nothrow move constructible.The text was updated successfully, but these errors were encountered: