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++/40655] The copy constructor is not needed but GCC (C++) don't let me to initialize my object instance!



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


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