gcc-3.4.2/4.0.0
Linux **** 2.6.9 #17 Fri Nov 12 15:59:30 NOVT 2004 i686 athlon i386 GNU/Linux
Fedora Core 3

gcc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix --disa
Thread model: posix
gcc version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3)

g++ test.cpp

[EMAIL PROTECTED] temp]$ g++ test.cpp
test.cpp: In function `int main()':
test.cpp:10: error: `A::A(const A&)' is private
test.cpp:16: error: within this context

test.cpp:

class A {
public:
A() {}
const A& operator=(const A& a) {
    return *this;
}

private:
A(const A& a) {}
};

A a;
int main() {
    A *pa = &a;
    *pa = A();
}

-- 
           Summary: g++ attempts to use copy constructor instead of operator
                    = on instantiated object
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: megath at iof dot ru
                CC: gcc-bugs at gcc dot gnu dot org


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

Reply via email to