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
Concurrent queue types don't define assignment operators #373
Comments
This fixes incorrect return types of assignment operators imported from base classes. Other than copy and move assignment operators, which are generated by the compiler even if imported with a using-declaration, the imported operators will be returning a reference to the base class instead of the derived class. In concurrent_queue, the assignment operator was missing while copy/move constructors were present and contained non-trivial logic. The implicitly generated assignment operator would have been incorrect. The added assignment operator reuses copy/move constructors to implement assignment. In concurrent_bounded_queue, the assignment operator was also missing and would have been deleted because of std::atomic member, while the class also had copy and move constructors. The added assignment operator also reuses the existing constructors. Fixes oneapi-src#372. Fixes oneapi-src#373.
@kboyarinov, can you please look at the issue and related pull request? |
while specification for concurrent_queue and concurrent_bounded_queue are missing |
I would argue that if a type has a copy/move constructor, it is expected for it to also have the corresponding assignment operator. |
This fixes incorrect return types of assignment operators imported from base classes. Other than copy and move assignment operators, which are generated by the compiler even if imported with a using-declaration, the imported operators will be returning a reference to the base class instead of the derived class. In concurrent_queue, the assignment operator was missing while copy/move constructors were present and contained non-trivial logic. The implicitly generated assignment operator would have been incorrect. The added assignment operator reuses copy/move constructors to implement assignment. In concurrent_bounded_queue, the assignment operator was also missing and would have been deleted because of std::atomic member, while the class also had copy and move constructors. The added assignment operator also reuses the existing constructors. Fixes oneapi-src#312. Fixes oneapi-src#372. Fixes oneapi-src#373.
This fixes incorrect return types of assignment operators imported from base classes. Other than copy and move assignment operators, which are generated by the compiler even if imported with a using-declaration, the imported operators will be returning a reference to the base class instead of the derived class. In concurrent_queue, the assignment operator was missing while copy/move constructors were present and contained non-trivial logic. The implicitly generated assignment operator would have been incorrect. The added assignment operator reuses copy/move constructors to implement assignment. In concurrent_bounded_queue, the assignment operator was also missing and would have been deleted because of std::atomic member, while the class also had copy and move constructors. The added assignment operator also reuses the existing constructors. Fixes oneapi-src#312. Fixes oneapi-src#372. Fixes oneapi-src#373. Signed-off-by: Andrey Semashev <andrey.semashev@gmail.com>
In concurrent_queue, the assignment operator was missing while copy/move constructors were present and contained non-trivial logic. The implicitly generated assignment operator would have been incorrect. The added assignment operator reuses copy/move constructors to implement assignment. In concurrent_bounded_queue, the assignment operator was also missing and would have been deleted because of std::atomic member, while the class also had copy and move constructors. The added assignment operator also reuses the existing constructors. Fixes oneapi-src#373. Signed-off-by: Andrey Semashev <andrey.semashev@gmail.com>
In concurrent_queue, the assignment operator was missing while copy/move constructors were present and contained non-trivial logic. The implicitly generated assignment operator would have been incorrect. The added assignment operator reuses copy/move constructors to implement assignment. In concurrent_bounded_queue, the assignment operator was also missing and would have been deleted because of std::atomic member, while the class also had copy and move constructors. The added assignment operator also reuses the existing constructors. Fixes oneapi-src#373. Signed-off-by: Andrey Semashev <andrey.semashev@gmail.com>
Specification patch for problem uxlfoundation/oneAPI-spec#396 |
concurrent_queue
andconcurrent_bounded_queue
define non-trivial copy and move constructor, but don't define assignment operators. The implicitly generated copy assignment will be incorrect forconcurrent_queue
and deleted (because ofstd::atomic
member) forconcurrent_bounded_queue
, neither of which is expected by user.Should be fixed by #318.
The text was updated successfully, but these errors were encountered: