[llvm-bugs] [Bug 27821] New: Valid code rejected - Initializing a dynamic array of non-default constructible objects

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 19 20:25:53 PDT 2016


https://llvm.org/bugs/show_bug.cgi?id=27821

            Bug ID: 27821
           Summary: Valid code rejected - Initializing a dynamic array of
                    non-default constructible objects
           Product: clang
           Version: 3.8
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vsoftco at gmail.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following code should be accepted in C++11, as new expressions allow
list-initializations:

struct Foo
{
    Foo(int){} // no default constructor
};

int main()
{
    Foo* pFoo = new Foo[2]{1,2}; // OK in g++, fails in clang++!
    delete[] pFoo;
}   

However, clang 3.8 (and previous versions) rejects it.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160520/96103319/attachment-0001.html>


More information about the llvm-bugs mailing list