This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/28365] New: error: ' error: 'MyClass::MyClass(const MyClass&)' is private error: within this context
- From: "kk at microfocus dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Jul 2006 23:05:39 -0000
- Subject: [Bug c++/28365] New: error: ' error: 'MyClass::MyClass(const MyClass&)' is private error: within this context
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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