This test case ... template <typename T> struct MoveRef { operator T& () {} }; template <typename T> MoveRef <T> Move(T&) {} struct Thing {}; Thing foo(const Thing* p) { return Thing(Move(*p)); } ... generates these diagnostics from g++ 4.6.1 in c++0x/gnu++0x mode, but not in c++98/gnu++98 mode: t.cc: In function ‘Thing foo(const Thing*)’: t.cc:4:50: error: call of overloaded ‘Thing(MoveRef<const Thing>)’ is ambiguous t.cc:4:50: note: candidates are: t.cc:3:8: note: constexpr Thing::Thing(const Thing&) t.cc:3:8: note: constexpr Thing::Thing(Thing&&) This is a regression from g++ 4.5.x and earlier.
More specifically, r178746 from SVN gcc-4_6-branch is affected, while r178501 from the same branch is not.
maybe the fix for PR 49267 then, Jason?
yep, confirmed that r178552 changed the behaviour
Author: jason Date: Sat Sep 17 22:35:10 2011 New Revision: 178932 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=178932 Log: PR c++/50442 Revert: PR c++/49267 * call.c (compare_ics): rvaluedness_matches_p can differ based on the source type, not just target. Removed: branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/rv-conv1.C Modified: branches/gcc-4_6-branch/gcc/cp/ChangeLog branches/gcc-4_6-branch/gcc/cp/call.c branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
Fixed by reverting the earlier patch.
Author: jason Date: Tue Sep 20 19:25:32 2011 New Revision: 179015 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=179015 Log: PR c++/50442 * g++.dg/overload/ref-conv1.C: New. Added: trunk/gcc/testsuite/g++.dg/overload/ref-conv1.C Modified: trunk/gcc/testsuite/ChangeLog