[LLVMbugs] [Bug 13164] New: MS compatibility: placement operator new[] is falls back to operator new

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Jun 21 04:51:56 PDT 2012


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

             Bug #: 13164
           Summary: MS compatibility: placement operator new[] is falls
                    back to operator new
           Product: clang
           Version: trunk
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: avakar at ratatanek.cz
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


MSVC 10 (and presumably the previous versions as well) will compile the
following without errors

    #include <stddef.h>
    struct arbitrary_t {} arbitrary;
    void * operator new(size_t size, arbitrary_t);

    int main() {
        int * p = new(arbitrary) int[4];
    }

On the other hand, clang will (correctly) report

    test.cpp:7:15: error: no matching function for call to 'operator new[]'
        int * p = new(arbitrary) int[4];
                  ^  ~~~~~~~~~~~

Unfortunately, the <new> header in MS's WDK only contains the non-array version
of operator new(std::size_t, std::nothrow), which prevents anything that
depends on WDK from being buildable with clang.

-- 
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