[Bug c++/14213] strange behavior with private cp-cstr...
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Feb 19 17:15:00 GMT 2004
------- 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
More information about the Gcc-bugs
mailing list