[libcxx] r222316 - Revert r222296 to fix bad commit message
Eric Fiselier
eric at efcs.ca
Tue Nov 18 21:41:29 PST 2014
Author: ericwf
Date: Tue Nov 18 23:41:29 2014
New Revision: 222316
URL: http://llvm.org/viewvc/llvm-project?rev=222316&view=rev
Log:
Revert r222296 to fix bad commit message
Removed:
libcxx/trunk/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp
libcxx/trunk/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp
Modified:
libcxx/trunk/test/language.support/support.types/nullptr_t.pass.cpp
Modified: libcxx/trunk/test/language.support/support.types/nullptr_t.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/language.support/support.types/nullptr_t.pass.cpp?rev=222316&r1=222315&r2=222316&view=diff
==============================================================================
--- libcxx/trunk/test/language.support/support.types/nullptr_t.pass.cpp (original)
+++ libcxx/trunk/test/language.support/support.types/nullptr_t.pass.cpp Tue Nov 18 23:41:29 2014
@@ -18,62 +18,42 @@ struct A
A(std::nullptr_t) {}
};
-template <class T>
-void test_conversions()
-{
- {
- T p = 0;
- assert(p == nullptr);
- }
- {
- T p = nullptr;
- assert(p == nullptr);
- assert(nullptr == p);
- assert(!(p != nullptr));
- assert(!(nullptr != p));
- }
-}
-
-template <class T>
-void test_comparisons()
-{
- T p = nullptr;
- assert(p == nullptr);
- assert(p <= nullptr);
- assert(p >= nullptr);
- assert(!(p != nullptr));
- assert(!(p < nullptr));
- assert(!(p > nullptr));
- assert(nullptr == p);
- assert(nullptr <= p);
- assert(nullptr >= p);
- assert(!(nullptr != p));
- assert(!(nullptr < p));
- assert(!(nullptr > p));
-}
-
-
int main()
{
static_assert(sizeof(std::nullptr_t) == sizeof(void*),
"sizeof(std::nullptr_t) == sizeof(void*)");
-
- {
- test_conversions<std::nullptr_t>();
- test_conversions<void*>();
- test_conversions<A*>();
- test_conversions<void(*)()>();
- test_conversions<void(A::*)()>();
- test_conversions<int A::*>();
- }
- {
- test_comparisons<std::nullptr_t>();
- test_comparisons<void*>();
- test_comparisons<A*>();
- test_comparisons<void(*)()>();
- }
- {
- bool b = nullptr;
- assert(!b);
- }
+ A* p = 0;
+ assert(p == nullptr);
+ void (A::*pmf)() = 0;
+#ifdef __clang__
+ // GCC 4.2 can't handle this
+ assert(pmf == nullptr);
+#endif
+ int A::*pmd = 0;
+ assert(pmd == nullptr);
+ A a1(nullptr);
+ A a2(0);
+ bool b = nullptr;
+ assert(!b);
+ assert(nullptr == nullptr);
+ assert(nullptr <= nullptr);
+ assert(nullptr >= nullptr);
+ assert(!(nullptr != nullptr));
+ assert(!(nullptr < nullptr));
+ assert(!(nullptr > nullptr));
+ A* a = nullptr;
+ assert(a == nullptr);
+ assert(a <= nullptr);
+ assert(a >= nullptr);
+ assert(!(a != nullptr));
+ assert(!(a < nullptr));
+ assert(!(a > nullptr));
+ assert(nullptr == a);
+ assert(nullptr <= a);
+ assert(nullptr >= a);
+ assert(!(nullptr != a));
+ assert(!(nullptr < a));
+ assert(!(nullptr > a));
+ std::ptrdiff_t i = reinterpret_cast<std::ptrdiff_t>(nullptr);
+ assert(i == 0);
}
Removed: libcxx/trunk/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp?rev=222315&view=auto
==============================================================================
--- libcxx/trunk/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp (original)
+++ libcxx/trunk/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp (removed)
@@ -1,17 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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.
-//
-//===----------------------------------------------------------------------===//
-
-// typedef decltype(nullptr) nullptr_t;
-
-#include <cstddef>
-
-int main()
-{
- std::ptrdiff_t i = static_cast<std::ptrdiff_t>(nullptr);
-}
Removed: libcxx/trunk/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp?rev=222315&view=auto
==============================================================================
--- libcxx/trunk/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp (original)
+++ libcxx/trunk/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp (removed)
@@ -1,24 +0,0 @@
-//===----------------------------------------------------------------------===//
-//
-// 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.
-//
-//===----------------------------------------------------------------------===//
-
-// NOTE: nullptr_t emulation cannot handle a reinterpret_cast to an
-// integral type
-// XFAIL: c++98, c++03
-
-// typedef decltype(nullptr) nullptr_t;
-
-
-#include <cstddef>
-#include <cassert>
-
-int main()
-{
- std::ptrdiff_t i = reinterpret_cast<std::ptrdiff_t>(nullptr);
- assert(i == 0);
-}
More information about the cfe-commits
mailing list