[PATCH] D42354: Fix libcxx MSVC C++17 redefinition of 'align_val_t'

Force.Charlie-I via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 21 08:35:06 PST 2018

fcharlie created this revision.
Herald added a reviewer: EricWF.
Herald added a subscriber: cfe-commits.

When use

  clang-cl -std:c++17 -Iinclude\c++\v1 hello.cc c++.lib

  In file included from hello.cc:1:
  In file included from include\c++\v1\iostream:38:
  In file included from include\c++\v1\ios:216:
  In file included from include\c++\v1\__locale:15:
  In file included from include\c++\v1\string:477:
  In file included from include\c++\v1\string_view:176:
  In file included from include\c++\v1\__string:56:
  In file included from include\c++\v1\algorithm:643:
  In file included from include\c++\v1\memory:656:
  include\c++\v1\new(165,29):  error: redefinition of 'align_val_t'
  enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include\vcruntime_new.h(43,16):  note:
        previous definition is here
      enum class align_val_t : size_t {};
  1 error generated.

  rCXX libc++



Index: include/new
--- include/new
+++ include/new
@@ -160,6 +160,9 @@
 #endif  // defined(_LIBCPP_BUILDING_NEW) || (_LIBCPP_STD_VER > 11)
+#if defined(_LIBCPP_ABI_MICROSOFT) && defined(_HAS_ALIGNED_NEW)
+/// vcruntime_new.h defined align_val_t
 #ifndef _LIBCPP_CXX03_LANG
 enum class _LIBCPP_ENUM_VIS align_val_t : size_t { };
@@ -167,6 +170,7 @@
 enum align_val_t { __zero = 0, __max = (size_t)-1 };
 }  // std

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42354.130811.patch
Type: text/x-patch
Size: 593 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180121/0987c893/attachment.bin>

More information about the cfe-commits mailing list