[LLVMbugs] [Bug 13470] New: [Xcode 4.4] non-static initialization in templates wrongly calls move constructor

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jul 26 19:21:43 PDT 2012


http://llvm.org/bugs/show_bug.cgi?id=13470

             Bug #: 13470
           Summary: [Xcode 4.4] non-static initialization in templates
                    wrongly calls move constructor
           Product: new-bugs
           Version: 3.1
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: littlekid87 at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified


Non-static initialization in template classes seems to calls move constructor
rather than the normal constructor.

Example Code:
----------------------------------------
#include <iostream>
#include <atomic>

//
// This class can compile
//
class Working
{
public:
    int GetValue() { return value_; }

private:
    std::atomic<int> value_{0};
};

//
// This class cannot compile
//
template <typename Ty1>
class NotWorking
{
public:
    int GetValue() { return value_; }

    private:
        std::atomic<int> value_{0}; // <---- error here
};

int main(int argc, const char * argv[])
{
    Working working;
    NotWorking<int> not_working;

    return 0;
}

Error Code By Xcode 4.4
-----------------------
"Copying member subobject of type 'std::atomic<int>' invokes deleted
constructor"

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list