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++/28365] New: error: ' error: 'MyClass::MyClass(const MyClass&)' is private error: within this context


class MyClass
{
public:
 MyClass() {}
 MyClass(int i) { m_i = i;}
private:
 MyClass(const MyClass& x) {};
 int m_i;
};
class MyInserter
{
public:
 MyInserter() {};
 MyInserter& operator<<(const MyClass& m) {m_c = m; return *this;};
private:
 MyClass m_c;
};

int main()
{
 MyClass a(1);
 MyInserter m;
 m << a;
 m << MyClass(2);

 return 0;
}


In this case a new MyClass  node is not suppose to be constructed so a
constructor should not be needed. This works on gcc 3.2 does not work on 4.1.1

RogueWave has this throughout it's code.


-- 
           Summary:     error: ' error: 'MyClass::MyClass(const MyClass&)'
                    is private   error: within this context
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kk at microfocus dot com


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


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