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

             Bug #: 50442
           Summary: Constructing T from implicit conversion to T&
                    ambiguous in C++0x mode, not C++98
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: za...@panix.com


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.

Reply via email to