- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, surprisingly the following code generates an error:
#include <utility>
struct A
{
A & operator=(A &&);
A & operator=(A const &) = delete;
};
struct B
{
A a;
};
int main()
{
B b1, b2;
b1 = std::move(b2); // calls B's implicitly-declared move assignment operator which should call A's move assignment operator
return 0;
}
The error report is: function "A::operator=(const A &)" (declared at line 5) cannot be referenced -- it is a deleted function
The compiler wants to call A's copy assignment operator. I think this is not correct.
What do you think?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do previous posts on this question, e.g. https://software.intel.com/en-us/forums/topic/496266 shed any light? You would need to report your specific g++ or MSVC version and options used to go anywhere with this.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Do previous posts on this question, e.g. https://software.intel.com/en-us/forums/topic/496266 shed any light? You would need to report your specific g++ or MSVC version and options used to go anywhere with this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
My reply was accepted but didn't show up. Sorry if this duplicates.
I don't want to repeat previous discussions, e.g.
https://software.intel.com/en-us/forums/topic/496266
You didn't say whether you have an MSVC or g++ which supports your usage.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Tim,
yes, the post you mention does shed light.
I use MSVC2013 and the November CTP compiler. This combination implicitly generates the move assignment operator.
Switching to the Intel compiler with "CTP_Nov2013" base platform toolset does not work, but now I know that this is intentional.
The hidden compiler switch is the solution.
Thank you, Tim.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page