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