This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/40655] The copy constructor is not needed but GCC (C++) don't let me to initialize my object instance!
- From: "MSHojatoleslami at Gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Jul 2009 17:19:50 -0000
- Subject: [Bug c++/40655] The copy constructor is not needed but GCC (C++) don't let me to initialize my object instance!
- References: <bug-40655-17912@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from MSHojatoleslami at Gmail dot com 2009-07-06 17:19 -------
Thanks for your answer.
But there is no need to copy them always as you know:
// ---------- begin
#include <iostream>
class A
{
public :
A (int i)
{
std::cout << "Copy constructor is not used." << std::endl;
}
};
int main ()
{
auto a1 = A (5); // Straight Construction
A a2[3] = { A (0), A (1), A (2) }; // Straight Construction
}
// ---------- end
So, why copy constructor needed to be public, although it's not used!?
Excuse me, If i insist on it. Because i really don't know why it's not a bug,
Specially for "auto" keyword.
There is XFC classes (XFC toolkit that wraps Gtk+) that their copy constructors
are private for some reason, and now, there is no way to use "auto" keyword to
initialize them. Instead, i must to initialize them with the old ways of
standard C++03.
--
MSHojatoleslami at Gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Resolution|INVALID |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40655