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]

Re: [Bug c++/37721] Segmentation fault




Sent from my iPhone

On Oct 3, 2008, at 1:38 AM, "ivranos at freemail dot gr" <gcc-bugzilla@gcc.gnu.org > wrote:



------- Comment #9 from ivranos at freemail dot gr 2008-10-03 08:38 -------
I am sorry but you are not right/specific.


At first there is no struct in the code, only class.

In C++ structs/classes are the same thing except if it is private or public by defaut.


Second, the copy
constructor does not copy the passed argument, it ignores it.

And that is the bug really. Sort uses the copy construct to swap two elements of the vector. So you will generate random data again and again and the sort becomes confused.


Note std::sort uses std::swap which is defined this way.

Sorry but there is no bug in the library or GCC.

But it
initialises its data member the same way as the main constructor.

So, there isn't any bug.


--


ivranos at freemail dot gr changed:

What |Removed |Added
--- --- ----------------------------------------------------------------------
Status|RESOLVED |UNCONFIRMED
Component|libstdc++ |c++
Resolution|INVALID |



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




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