This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14213] strange behavior with private cp-cstr...
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Feb 2004 17:15:54 -0000
- Subject: [Bug c++/14213] strange behavior with private cp-cstr...
- References: <20040219170343.14213.pluto@ds14.agh.edu.pl>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-02-19 17:15 -------
I think this is not a bug as initiailizers are really called only with constructors but I have not looked at
the standard to make sure that is true.
This is so someone can just copy and paste it as your bug report has non-breaking spaces in there.
#include <iostream>
using namespace std;
class A {
public:
A() { cout << "A::A()\n"; }
A &operator = (const A &obj)
{
cout << "A::operator = (const A &)\n";
return *this;
}
private:
//public:
A(const A &obj) { cout << "A::A(const A &)\n"; }
};
int main()
{
A a1;
A a2 = a1;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14213