If a class was written before C++11 and thus has a copy constructor but no move constructor, then a discarded reloc may have precisely the wrong effect, constructing and destroying a temporary with overhead and no effect on the source object. This may sound unlikely, but in industry it's not unusual to have to work with vendor code that was written a very long time ago or has to target ancient compilers as well as modern ones.
I think it might be necessary to make discarded-reloc ill-formed if the source object is a function parameter and the constructor selected for relocation would be a copy constructor. Either that or call it out with a strong hint that implementations should issue a warning, but we may as well get this right to start with.
If a class was written before C++11 and thus has a copy constructor but no move constructor, then a discarded
relocmay have precisely the wrong effect, constructing and destroying a temporary with overhead and no effect on the source object. This may sound unlikely, but in industry it's not unusual to have to work with vendor code that was written a very long time ago or has to target ancient compilers as well as modern ones.I think it might be necessary to make discarded-
relocill-formed if the source object is a function parameter and the constructor selected for relocation would be a copy constructor. Either that or call it out with a strong hint that implementations should issue a warning, but we may as well get this right to start with.