The following program :
=================================
struct A {
        A& operator=(const A&) = delete;

        void operator=(int) {}
        void operator=(char) {}
};

struct B {};

int main()
{
        A a;
        a = B(); // no match
        a = 1.0; // ambiguous
}
==============================

produces, with g++ -std=c++0x, current trunk version, the following
two error messages :

test_note_deleted_function.cpp: In function 'int main()':
test_note_deleted_function.cpp:13: error: no match for 'operator=' in 'a = B()'
test_note_deleted_function.cpp:2: note: candidates are: A& A::operator=(const
A&)
test_note_deleted_function.cpp:4: note:                 void A::operator=(int)
test_note_deleted_function.cpp:5: note:                 void A::operator=(char)
test_note_deleted_function.cpp:14: error: ambiguous overload for 'operator=' in
'a = 1.0e+0'
test_note_deleted_function.cpp:4: note: candidates are: void A::operator=(int)
test_note_deleted_function.cpp:5: note:                 void A::operator=(char)


Note how the deleted assignment operator is listed as candidate in the
"no match" error.  It should probably be removed.

The "ambiguous overload" case does not mention it as candidate, which I think
is the right thing to do.


-- 
           Summary: [c++0x] deleted functions not removed from "no match"
                    error messages
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sylvain dot pion at sophia dot inria dot fr
  GCC host triplet: i386-apple-darwin9.6.0


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

Reply via email to