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

             Bug #: 13884
           Summary: initializer list in new[] for objects always calls
                    default constructor
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified


I'm trying to use the following initialization (example):

struct Data
{
    float values[3];

    Data()
    :
        values({0, 0, 0})
    {
        std::cout << "Default constructor" << std::endl;
    }

    Data(float a, float b, float c)
    :
        values({a, b, c})
    {
        std::cout << "Initialization constructor" << std::endl;
    }
};

int main (int argc, char const* argv[])
{
    Data *data = new Data[1] {
        Data(0, 1, 2)
    };

    return 0;
}

Using g++ this gives the correct result (i.e. it's calling the initialization
constructor). However, using clang++ the default constructor is always called.

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to