Page MenuHomePhabricator

[libc++] Don't define operator new/delete when using vcruntime
ClosedPublic

Authored by thomasanderson on Jan 28 2019, 4:22 PM.

Details

Summary

Fixes build errors on Windows without libc++abi of the form:

new(173,36):  error: redeclaration of 'operator delete' cannot add 'dllexport' attribute
_LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p) _NOEXCEPT;
vcruntime_new.h(87,16):  note: previous declaration is here
void __CRTDECL operator delete(
new(205,70):  error: redefinition of 'operator new'
_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new  (std::size_t, void* __p) _NOEXCEPT {return __p;}
vcruntime_new.h(184,28):  note: previous definition is here
    inline void* __CRTDECL operator new(size_t _Size, _Writable_bytes_(_Size) void* _Where) noexcept
new(206,70):  error: redefinition of 'operator new[]'
_LIBCPP_NODISCARD_AFTER_CXX17 inline _LIBCPP_INLINE_VISIBILITY void* operator new[](std::size_t, void* __p) _NOEXCEPT {return __p;}
vcruntime_new.h(199,28):  note: previous definition is here
    inline void* __CRTDECL operator new[](size_t _Size,
new(207,40):  error: redefinition of 'operator delete'
inline _LIBCPP_INLINE_VISIBILITY void  operator delete  (void*, void*) _NOEXCEPT {}
vcruntime_new.h(190,27):  note: previous definition is here
    inline void __CRTDECL operator delete(void*, void*) noexcept
new(208,40):  error: redefinition of 'operator delete[]'
inline _LIBCPP_INLINE_VISIBILITY void  operator delete[](void*, void*) _NOEXCEPT {}
vcruntime_new.h(206,27):  note: previous definition is here
    inline void __CRTDECL operator delete[](void*, void*) noexcept

Diff Detail

Repository
rCXX libc++

Event Timeline

thomasanderson created this revision.Jan 28 2019, 4:22 PM

Not sure if this is the right fix, but the issue goes away with this patch

EricWF accepted this revision.Jan 29 2019, 5:44 PM
This revision is now accepted and ready to land.Jan 29 2019, 5:44 PM
This revision was automatically updated to reflect the committed changes.

This differential skipped -commits list during review.