http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50641

--- Comment #4 from Andy Lutomirski <luto at mit dot edu> 2011-10-07 06:57:01 
UTC ---
The problem I encountered that inspired this was:

#include <type_traits>
#include <map>

struct From
{
};

struct To
{
  To(const From &&) {}
  To(const To &) = delete;
  void operator = (const To &) = delete;
};

int main()
{
  std::map<int, To> m;
  m.insert(std::pair<int, From>(1, From()));
}

This works in 4.6.0 due to a different bug.  IMO it deserves to work -- the
implementation of map could move-construct the To object in place.  The
standard says explicitly that it's OK for To not to be CopyConstructible and,
indeed, this example works if I add:

To(const To &&) {}

I defer to the experts (and the people who have a copy of the FDIS) to figure
out whether it's supposed to work.  N3242 says that From needs to be
"convertible" to To, but I'm not at all convinced that "convertible" means the
same thing as "is_convertible".  Maybe if it's illegal I'll file a DR some day.

(N3242's section on map modifiers is woefully incomplete -- quite a few
functions are simply not there.  I hope the FDIS is better.)

Reply via email to