2 //===----------------------------------------------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
13 // template <class T> constexpr T* launder(T* p) noexcept;
14 // The program is ill-formed if T is a function type or cv void.
16 // UNSUPPORTED: c++98, c++03, c++11, c++14
21 #include "test_macros.h"
28 (void) std::launder(( void *) nullptr);
29 (void) std::launder((const void *) nullptr);
30 (void) std::launder(( volatile void *) nullptr);
31 (void) std::launder((const volatile void *) nullptr); // expected-error-re@new:* 4 {{static_assert failed{{.*}} "can't launder cv-void"}}
32 // expected-error@new:* 0-4 {{void pointer argument to '__builtin_launder' is not allowed}}
34 (void) std::launder(foo); // expected-error-re@new:* 1 {{static_assert failed{{.*}} "can't launder functions"}}
35 // expected-error@new:* 0-1 {{function pointer argument to '__builtin_launder' is not allowed}}