This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/14213] strange behavior with private cp-cstr...


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]