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: unassig...@gcc.gnu.org
        ReportedBy: anthony....@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

Reply via email to