Ah, OK. Maybe it would compile with VC 2013 by using LLVM_CONSTEXPR instead of constexpr. It's not available now in libcxx but the definition from Compiler.h is trivial.
2015-09-24 19:28 GMT+03:00 Nico Weber <tha...@chromium.org>: > On Thu, Sep 24, 2015 at 4:20 AM, Yaron Keren via cfe-commits < > cfe-commits@lists.llvm.org> wrote: > >> Visual C++ 2013 update 5 (latest) does not appear to compile this, mainly >> due to missing support for constexpr. >> >> https://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx >> >> Visual C++ 2013 CTP has constexpr, but MS did not further update this >> branch since Nov 2013. >> The "regular" branch of 2013 update 5 is from Jul 2015. >> >> Worth mentioning that either 2013 CTP or 2015 is required. >> > > Right the commit message hints at this with "clang-cl/MSVC2013's STL" – > with this change, _clang-cl_ can compile this file with the MSVC2013 > headers. cl.exe can't. cl.exe 2015 can, except for that one > __attribute__((visibiliiy("default"))) line. If that's changed to go > `#ifdef _MSC_VER __declspec(dllexport) #else __attr... #endif` then it > compiles with 2015. (I want to send out something for this soon too.) > > >> >> >> 2015-09-20 21:10 GMT+03:00 Nico Weber via cfe-commits < >> cfe-commits@lists.llvm.org>: >> >>> Author: nico >>> Date: Sun Sep 20 13:10:46 2015 >>> New Revision: 248129 >>> >>> URL: http://llvm.org/viewvc/llvm-project?rev=248129&view=rev >>> Log: >>> Let cxa_demangle.cpp compile with gcc/libstdc++ 4.8 and >>> clang-cl/MSVC2013's STL. >>> >>> libstdc++ needs a few typedefs in malloc_alloc. MSVC's STL needs >>> rebind(), >>> construct(), destroy(). MSVC2013 also has no snprintf, but it exists in >>> 2015. >>> >>> Modified: >>> libcxxabi/trunk/src/cxa_demangle.cpp >>> >>> Modified: libcxxabi/trunk/src/cxa_demangle.cpp >>> URL: >>> http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_demangle.cpp?rev=248129&r1=248128&r2=248129&view=diff >>> >>> ============================================================================== >>> --- libcxxabi/trunk/src/cxa_demangle.cpp (original) >>> +++ libcxxabi/trunk/src/cxa_demangle.cpp Sun Sep 20 13:10:46 2015 >>> @@ -18,6 +18,13 @@ >>> #include <cstring> >>> #include <cctype> >>> >>> +#ifdef _MSC_VER >>> +// snprintf is implemented in VS 2015 >>> +#if _MSC_VER < 1900 >>> +#define snprintf _snprintf_s >>> +#endif >>> +#endif >>> + >>> namespace __cxxabiv1 >>> { >>> >>> @@ -4818,6 +4825,12 @@ class malloc_alloc >>> { >>> public: >>> typedef T value_type; >>> + typedef T& reference; >>> + typedef const T& const_reference; >>> + typedef T* pointer; >>> + typedef const T* const_pointer; >>> + typedef std::size_t size_type; >>> + typedef std::ptrdiff_t difference_type; >>> >>> malloc_alloc() = default; >>> template <class U> malloc_alloc(const malloc_alloc<U>&) noexcept {} >>> @@ -4830,6 +4843,17 @@ public: >>> { >>> std::free(p); >>> } >>> + >>> + template <class U> struct rebind { using other = malloc_alloc<U>; }; >>> + template <class U, class... Args> >>> + void construct(U* p, Args&&... args) >>> + { >>> + ::new ((void*)p) U(std::forward<Args>(args)...); >>> + } >>> + void destroy(T* p) >>> + { >>> + p->~T(); >>> + } >>> }; >>> >>> template <class T, class U> >>> >>> >>> _______________________________________________ >>> cfe-commits mailing list >>> cfe-commits@lists.llvm.org >>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >>> >> >> >> _______________________________________________ >> cfe-commits mailing list >> cfe-commits@lists.llvm.org >> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >> >> >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits