This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/53202] New: Copy constructor not called when starting a thread
- From: "anthony.ajw at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 02 May 2012 21:14:20 +0000
- Subject: [Bug libstdc++/53202] New: Copy constructor not called when starting a thread
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53202
Bug #: 53202
Summary: Copy constructor not called when starting a thread
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: anthony.ajw@gmail.com
Created attachment 27291
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27291
Simple test program
When compiling and running the attached program the copy constructor for
background_hello should be called at least once. It is not being called at all,
but the function call operator is showing a different this pointer, and the
destructor is called 3 times.
~$ g++ --version
g++ (Ubuntu/Linaro 4.7.0-7ubuntu1) 4.7.0
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
~$ g++ -std=c++0x -pthread t.cpp && ./a.out
default ctor called, this=0x7fffc2b05bdf
destructor called, this=0x7fffc2b05b8f
void background_hello::operator()() called, this=0x922040
destructor called, this=0x922040
destructor called, this=0x7fffc2b05bdf