Created attachment 37541 [details] preprocessed source In some cases, it looks like the copy assignment operator is being used to store return values from a function instead of the move assignment operator. This causes the compilation to fail because it tries to use the copy-assignment operator of some classes which may be movable only (unique_ptr). Note that changing data_t to be either 'std::map<int, inner_data>' or 'std::map<int, value_t>' allows the code to compile. Let me know if I can provide any more details that would be helpful. gcc-5.3.0 x86_64-unknown-linux-gnu
Created attachment 37542 [details] Error output Error output from compiler. Note it also fails to indicate which line the problematic instantiation is on.
The value_type of your map is pair<const std::string, inner_data_t> an you can't move the first part of that pair, and you can't copy the second part of that pair, so you can't move or copy it.
(In reply to Jonathan Wakely from comment #2) > The value_type of your map is pair<const std::string, inner_data_t> an you > can't move the first part of that pair, and you can't copy the second part > of that pair, so you can't move or copy it. I'm not sure exactly what you mean/what the value_type typedef inside the map has to do with this. Note that std::map<std::string, unique_ptr<int>> does seem to work here (where presumably value_type is pair<const string, unique_ptr<int>>). Also, I just confirmed this did previously work on gcc-4.8.2
FWIW, this seems to be fixed on trunk. Still fails for at least 6.2, 5.4, and 4.9.4, but does compile with 7/trunk and 4.8.5 https://godbolt.org/g/hx9q4S
This is a duplicate of Bug 77334 which is fixed for 5.5, 6.3 and 7. *** This bug has been marked as a duplicate of bug 77334 ***
Thanks for the update : )
Comment on attachment 37541 [details] preprocessed source > #include <map> > #include <memory> > #include <string> >typedef std::unique_ptr<int> inner_value_t; >typedef std::map<int, inner_value_t> inner_data_t; > >typedef std::map<std::string, inner_data_t> data_t; > > >data_t foo() { > return data_t{}; >} > >int main(int argc, char **argv) >{ > > data_t d; > d = foo(); > return 0; >}