aboutsummaryrefslogtreecommitdiff
path: root/test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp')
-rw-r--r--test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp b/test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp
new file mode 100644
index 000000000000..71f5e4588b82
--- /dev/null
+++ b/test/std/language.support/support.dynamic/ptr.launder/launder.types.fail.cpp
@@ -0,0 +1,34 @@
+// -*- 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.
+//
+//===----------------------------------------------------------------------===//
+
+// <new>
+
+// template <class T> constexpr T* launder(T* p) noexcept;
+// The program is ill-formed if T is a function type or cv void.
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+#include <new>
+#include <cassert>
+
+#include "test_macros.h"
+
+void foo() {}
+
+int main ()
+{
+ void *p = nullptr;
+ (void) std::launder(( void *) nullptr);
+ (void) std::launder((const void *) nullptr);
+ (void) std::launder(( volatile void *) nullptr);
+ (void) std::launder((const volatile void *) nullptr); // expected-error-re@new:* 4 {{static_assert failed{{.*}} "can't launder cv-void"}}
+
+ (void) std::launder(foo); // expected-error-re@new:* 1 {{static_assert failed{{.*}} "can't launder functions"}}
+}