[LLVMbugs] [Bug 13380] New: Value/Default initialization of new in LLVM

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 17 04:04:13 PDT 2012


             Bug #: 13380
           Summary: Value/Default initialization of new in LLVM
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: naveen.c at samsung.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

In Clang, initialization done via new don't seem to follow the same
implementation as given in specs.(Ref: Section 5.3.4 para 15)


struct A
int i;

 a = new A[2]();
 printf("%d\n", a[0].i);

In the above example, it should initialize 'i' for all indices of array 'a',
however clang proceeds to calling constructor immediately after calling 
new[](size_t, void*).
In gcc there's an intermediate step which does the initialization part(inside a
loop) before calling constructor for the object.

Please share your thoughts if the interpretation of specs is correct here.

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