[PATCH] D31260: [libc++] Work around C1XX bug which breaks poisoned hash tests.

2017-03-22 Thread Casey Carter via Phabricator via cfe-commits
CaseyCarter added a comment.

I also have no problem with this change.




Comment at: test/support/poisoned_hash_helper.hpp:53
 using LibraryHashTypes = TypeList<
+#if !defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
 #if TEST_STD_VER > 14

I would merge these conditionals since they have identical extent. YMMV ;)



Comment at: 
test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp:16
+
+#include 
+

IIRC, including "" headers before <> headers is not conventional for the test 
suite.


https://reviews.llvm.org/D31260



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31260: [libc++] Work around C1XX bug which breaks poisoned hash tests.

2017-03-22 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added a comment.

In https://reviews.llvm.org/D31260#708139, @BillyONeal wrote:

>   (Though you might want something like this anyway if you try libc++ with 
> MSVC++ on Windows...)


Exactly why I volunteered to do this. As libc++ and MSVC implement C++17 at 
different rates I suspect we'll need temporary workarounds like this more often.


https://reviews.llvm.org/D31260



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31260: [libc++] Work around C1XX bug which breaks poisoned hash tests.

2017-03-22 Thread Billy Robert O'Neal III via Phabricator via cfe-commits
BillyONeal accepted this revision.
BillyONeal added a comment.
This revision is now accepted and ready to land.

I mean, looks good to me, but you really don't need to go there :). (Though you 
might want something like this anyway if you try libc++ with MSVC++ on 
Windows...)


https://reviews.llvm.org/D31260



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D31260: [libc++] Work around C1XX bug which breaks poisoned hash tests.

2017-03-22 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF created this revision.

This is my attempt to work around the C1XX bug described to me by @BillyONeal.


https://reviews.llvm.org/D31260

Files:
  test/support/poisoned_hash_helper.hpp
  test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
  test/support/test_macros.h
  test/support/test_workarounds.h

Index: test/support/test_workarounds.h
===
--- /dev/null
+++ test/support/test_workarounds.h
@@ -0,0 +1,20 @@
+// -*- C++ -*-
+//=== test_macros.h ---===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+#ifndef SUPPORT_TEST_WORKAROUNDS_H
+#define SUPPORT_TEST_WORKAROUNDS_H
+
+#include "test_macros.h"
+
+#if defined(TEST_COMPILER_C1XX)
+# define TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR
+#endif
+
+#endif // SUPPORT_TEST_WORKAROUNDS_H
Index: test/support/test_macros.h
===
--- test/support/test_macros.h
+++ test/support/test_macros.h
@@ -52,6 +52,17 @@
 #define TEST_HAS_BUILTIN_IDENTIFIER(X) 0
 #endif
 
+#if defined(__clang__)
+#define TEST_COMPILER_CLANG
+# if defined(__apple_build_version__)
+#   define TEST_COMPILER_APPLE_CLANG
+# endif
+#elif defined(_MSC_VER)
+# define TEST_COMPILER_C1XX
+#elif defined(__GNUC__)
+# define TEST_COMPILER_GCC
+#endif
+
 #if defined(__apple_build_version__)
 #define TEST_APPLE_CLANG_VER (__clang_major__ * 100) + __clang_minor__
 #elif defined(__clang_major__)
Index: test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
===
--- /dev/null
+++ test/support/test.workarounds/c1xx_broken_nullptr_conversion_operator.pass.cpp
@@ -0,0 +1,29 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03
+
+// Verify TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR.
+
+#include "test_workarounds.h"
+
+#include 
+
+struct ConvertsToNullptr {
+  using DestType = decltype(nullptr);
+  operator DestType() const { return nullptr; }
+};
+
+int main() {
+#if defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
+  static_assert(!std::is_convertible::value, "");
+#else
+  static_assert(std::is_convertible::value, "");
+#endif
+}
Index: test/support/poisoned_hash_helper.hpp
===
--- test/support/poisoned_hash_helper.hpp
+++ test/support/poisoned_hash_helper.hpp
@@ -14,6 +14,7 @@
 #include 
 
 #include "test_macros.h"
+#include "test_workarounds.h"
 
 #if TEST_STD_VER < 11
 #error this header may only be used in C++11 or newer
@@ -49,9 +50,11 @@
 // specializations of hash for nullptr t and all cv-unqualified
 // arithmetic, enumeration, and pointer types.
 using LibraryHashTypes = TypeList<
+#if !defined(TEST_WORKAROUND_C1XX_BROKEN_NULLPTR_CONVERSION_OPERATOR)
 #if TEST_STD_VER > 14
   decltype(nullptr),
 #endif
+#endif
   bool,
   char,
   signed char,
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits