Implicitly constructing temporary string objects by passing C-strings to methods or functions that are overloaded for both r-val references and const l-val references (such as any container insertion method) results in calling of the const-l-val-version rather than the r-val-version, even though the string object passed is evidently only a temporary object.The problem affects more than just strings, but it is particularly annoying for these, as passing C-strings to methods taking string objects is rather common.In fact, it seems that any referencing of objects existing outside the expression to be implicitly converted inside this expression provokes this issue, e.g. by implicitly calling int_test_class(int i) with a non-temporary integer.
Visual Studio/Team Foundation Server/.NET Framework Tooling version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results
Please wait...