| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
llvm-svn: 224658
|
|
|
|
|
|
|
|
|
|
| |
Reviewers: dschuff, danalbert
Subscribers: jfb, cfe-commits
Differential Revision: http://reviews.llvm.org/D6411
llvm-svn: 222842
|
|
|
|
| |
llvm-svn: 222406
|
|
|
|
| |
llvm-svn: 222405
|
|
|
|
| |
llvm-svn: 222383
|
|
|
|
|
|
|
|
|
|
|
| |
The standard requires that nullptr_t can be reinterpret_cast to an integral type
at least the size of nullptr_t. There is no way to emulate this conversion in
the C++03 nullptr_t implementation. The test for this conversion has been moved
to a new test and marked XFAIL with c++03.
This recommits what was originally r222296.
llvm-svn: 222318
|
|
|
|
| |
llvm-svn: 222316
|
|
|
|
|
|
|
|
|
| |
Wrap the original test in _LIBCPP_HAS_QUICK_EXIT so it only runs when we have
quick_exit and add two new tests that check that when _LIBCPP_HAS_QUICK_EXIT
is not defined then no definition of std::at_quick_exit or std::quick_exit are
available.
llvm-svn: 222298
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
b/test/language.support/support.types/nullptr_t.pass.cpp
index 6c15fef..4d7c8b0 100644
--- a/test/language.support/support.types/nullptr_t.pass.cpp
+++ b/test/language.support/support.types/nullptr_t.pass.cpp
@@ -18,42 +18,62 @@ 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*)");
- 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);
+
+ {
+ 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);
+ }
}
diff --git a/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp b/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp
new file mode 100644
index 0000000..92bd879
--- /dev/null
+++ b/test/language.support/support.types/nullptr_t_integral_cast.fail.cpp
@@ -0,0 +1,17 @@
+//===----------------------------------------------------------------------===//
+//
+// 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);
+}
diff --git a/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp b/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp
new file mode 100644
index 0000000..34c7a93
--- /dev/null
+++ b/test/language.support/support.types/nullptr_t_integral_cast.pass.cpp
@@ -0,0 +1,24 @@
+//===----------------------------------------------------------------------===//
+//
+// 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);
+}
llvm-svn: 222296
|
|
|
|
| |
llvm-svn: 222282
|
|
|
|
|
|
|
|
|
|
| |
These tests fail for 2 reasons when using ASAN and MSAN.
1. If allocator_may_return_null=0 they will fail because null is returned
or an exception is thrown.
2. When allocator_may_return_null=1 the new_handler is still not called. This
results in an assertion failures.
llvm-svn: 221967
|
|
|
|
| |
llvm-svn: 221240
|
|
|
|
|
|
|
| |
tests that replace operator new/delete won't link when using ASAN and MSAN
because these sanitizers also replace new/delete.
llvm-svn: 221236
|
|
|
|
| |
llvm-svn: 220296
|
|
|
|
|
|
| |
reporting true, for all arithmetic types, which is incorrect. Fix the tests which were wrong, too. This fixes PR#20158.
llvm-svn: 214371
|
|
|
|
|
|
|
|
|
|
| |
__[u]int128_t
This commit also adds tests for std::numeric_limits<__[u]int128_t>.
Reviewed in http://llvm-reviews.chandlerc.com/D2917
llvm-svn: 204849
|
|
|
|
|
|
| |
Fixes bug #18468
llvm-svn: 200724
|
|
|
|
|
|
| |
Grubb for the catch.
llvm-svn: 200108
|
|
|
|
| |
llvm-svn: 199695
|
|
|
|
|
|
| |
Fang for the report (and suggested fix)
llvm-svn: 199694
|
|
|
|
| |
llvm-svn: 196041
|
|
|
|
| |
llvm-svn: 190614
|
|
|
|
| |
llvm-svn: 189271
|
|
|
|
| |
llvm-svn: 186334
|
|
|
|
| |
llvm-svn: 185865
|
|
|
|
| |
llvm-svn: 174450
|
|
|
|
|
|
| |
because the optimizer was eliminating the call to new.
llvm-svn: 172631
|
|
|
|
|
|
| |
http://llvm.org/bugs/show_bug.cgi?id=14585.
llvm-svn: 170026
|
|
|
|
| |
llvm-svn: 159846
|
|
|
|
| |
llvm-svn: 152716
|
|
|
|
| |
llvm-svn: 137522
|
|
|
|
|
|
|
|
|
|
| |
itself non-throwing. Since nested_exception's destructor is
non-throwing, if B's destructor is not, this causes an error in C++03
mode due to the overriding function having a more lax specification.
This did not occur in C++0x mode as A's destructor was implicitly
non-throwing.
llvm-svn: 135400
|
|
|
|
|
|
| |
evaluating the throw-expression rather than after
llvm-svn: 127499
|
|
|
|
|
|
| |
for nullptr_t.
llvm-svn: 127338
|
|
|
|
| |
llvm-svn: 120712
|
|
|
|
| |
llvm-svn: 119395
|
|
|
|
| |
llvm-svn: 119383
|
|
|
|
| |
llvm-svn: 113098
|
|
|
|
| |
llvm-svn: 113097
|
|
|
|
|
|
| |
flags, and renamed _LIBCPP_MOVE to _LIBCPP_HAS_NO_RVALUE_REFERENCES to be more consistent with the rest of the libc++'s flags, and with clang's nomenclature.
llvm-svn: 113086
|
|
|
|
| |
llvm-svn: 111778
|
|
|
|
| |
llvm-svn: 111760
|
|
|
|
| |
llvm-svn: 110724
|
|
|
|
| |
llvm-svn: 104975
|
|
|
|
| |
llvm-svn: 104943
|
|
|
|
| |
llvm-svn: 104850
|
|
|
|
| |
llvm-svn: 103794
|
|
|
|
| |
llvm-svn: 103516
|
|
llvm-svn: 103490
|