summaryrefslogtreecommitdiff
path: root/test/std
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-07-01 13:24:37 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-07-01 13:24:37 +0000
commit9d043122e0fc90510de06d43da8eda827464c1da (patch)
treef1eb4415067a94e88da72ff1845a1ce41a8938be /test/std
parentd23de13b3208b94a25e1de463ea3155911512e61 (diff)
Notes
Diffstat (limited to 'test/std')
-rw-r--r--test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp36
-rw-r--r--test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp22
-rw-r--r--test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp32
3 files changed, 54 insertions, 36 deletions
diff --git a/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp b/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp
deleted file mode 100644
index f9f487dc7ef8e..0000000000000
--- a/test/std/language.support/support.dynamic/new.delete/new.delete.placement/new_deployment.fail.cpp
+++ /dev/null
@@ -1,36 +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.
-//
-//===----------------------------------------------------------------------===//
-
-// UNSUPPORTED: c++98, c++03, c++11, c++14
-// REQUIRES: availability=macosx10.12
-
-// test availability of new/delete operators introduced in c++17.
-
-#include <new>
-
-int main () {
- int *p0 = new ((std::align_val_t)16) int(1);
- (void)p0;
- int *p1 = new ((std::align_val_t)16) int[1];
- (void)p1;
- // expected-error@-4 {{call to unavailable function 'operator new': introduced in macOS 10.13}}
- // expected-note@new:* {{candidate function has been explicitly made unavailable}}
- // expected-note@new:* {{candidate function not viable: no known conversion from 'std::align_val_t' to 'const std::nothrow_t' for 2nd argument}}
- // expected-note@new:* {{candidate function not viable: no known conversion from 'std::align_val_t' to 'void *' for 2nd argument}}
- // expected-note@new:* {{candidate function not viable: requires single argument '__sz', but 2 arguments were provided}}
- // expected-note@new:* {{candidate function not viable: requires 3 arguments, but 2 were provided}}
-
- // expected-error@-9 {{call to unavailable function 'operator new[]': introduced in macOS 10.13}}
- // expected-note@new:* {{candidate function has been explicitly made unavailable}}
- // expected-note@new:* {{candidate function not viable: no known conversion from 'std::align_val_t' to 'const std::nothrow_t' for 2nd argument}}
- // expected-note@new:* {{candidate function not viable: no known conversion from 'std::align_val_t' to 'void *' for 2nd argument}}
- // expected-note@new:* {{candidate function not viable: requires single argument '__sz', but 2 arguments were provided}}
- // expected-note@new:* {{candidate function not viable: requires 3 arguments, but 2 were provided}}
- return 0;
-}
diff --git a/test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp b/test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp
new file mode 100644
index 0000000000000..8e994126cc0d2
--- /dev/null
+++ b/test/std/utilities/utility/pairs/pair.astuple/tuple_element.fail.cpp
@@ -0,0 +1,22 @@
+//===----------------------------------------------------------------------===//
+//
+// 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <utility>
+
+// template <class T1, class T2> struct pair
+
+// tuple_element<I, pair<T1, T2> >::type
+
+#include <utility>
+
+int main()
+{
+ typedef std::pair<int, short> T;
+ typename std::tuple_element<2, T>::type foo; // expected-error@utility:* {{Index out of bounds in std::tuple_element<std::pair<T1, T2>>}}
+}
diff --git a/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp b/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp
new file mode 100644
index 0000000000000..cbaa2a568d5bf
--- /dev/null
+++ b/test/std/utilities/variant/variant.helpers/variant_alternative.fail.cpp
@@ -0,0 +1,32 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// 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, c++11, c++14
+
+// <variant>
+
+// template <size_t I, class T> struct variant_alternative; // undefined
+// template <size_t I, class T> struct variant_alternative<I, const T>;
+// template <size_t I, class T> struct variant_alternative<I, volatile T>;
+// template <size_t I, class T> struct variant_alternative<I, const volatile T>;
+// template <size_t I, class T>
+// using variant_alternative_t = typename variant_alternative<I, T>::type;
+//
+// template <size_t I, class... Types>
+// struct variant_alternative<I, variant<Types...>>;
+
+#include <memory>
+#include <type_traits>
+#include <variant>
+
+int main() {
+ using V = std::variant<int, void *, const void *, long double>;
+ typename std::variant_alternative<4, V>::type foo; // expected-error@variant:* {{Index out of bounds in std::variant_alternative<>}}
+}