gcc version 4.1.2 20060729 (prerelease) (Debian 4.1.1-10)

g++ wants a Moo(const Moo&) in this code:


class Moo
{
        Moo() { }
        Moo(const Moo&) { }
public:
        Moo(int) { }

};

void xyz(const Moo &)
{
}

int main()
{
        xyz(Moo(0));
        return 0;
}

test.cpp:5: error: 'Moo::Moo(const Moo&)' is private
test.cpp:17: error: within this context

Curiously, calling xyz() like so does work:
        Moo temp(0);
        xyz(temp);


-- 
           Summary: g++ wants a copy constructor for no reason
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: charles at vmware dot com
 GCC build triplet: i486-linux-gnu
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


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

Reply via email to