
Schrader, Glenn escribió:
The attached file produces the problem that I'm having. It compiles fine using 1.36 thru 1.38. When I use 1.39 or trunk I get the following errors (gcc 4.2.3 on 64bit Fedora 9):
<COMPILER_OUTPUT>
The compile is looking for 'Dummy::Dummy(const Abcd&)' but that constructor parameter is actually non-const. If I change the constructor to take a const parameter then the compile succeeds (which, of course, isn't what I want). Note that the attached test code is boiled down from a more complicated case where I had multiple constructor parameters but was seeing the same effect. Obviously, something changed between 1.38 and 1.39.
That was a change in the forwarding code. Since perfect forwarding can't be achieved in C++03, previously all parameters were taken as const T & and then unconsted, this means that sometimes incorrect overload was taken (non-const was preferred). Since usually all constructor parameters are non-const this was changed. I don't plan to change this behaviour, because that would break again code for current users.
Thanks,
--glenn
Best, Ion