1 // -*- C++ -*- 2 //===----------------------------------------------------------------------===// 3 // 4 // The LLVM Compiler Infrastructure 5 // 6 // This file is dual licensed under the MIT and the University of Illinois Open 7 // Source Licenses. See LICENSE.TXT for details. 8 // 9 //===----------------------------------------------------------------------===// 10 11 // <new> 12 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. 15 16 // UNSUPPORTED: c++98, c++03, c++11, c++14 17 18 #include <new> 19 #include <cassert> 20 21 #include "test_macros.h" 22 23 void foo() {} 24 25 int main () 26 { 27 void *p = nullptr; 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 33 (void) std::launder(foo); // expected-error-re@new:* 1 {{static_assert failed{{.*}} "can't launder functions"}} 34 } 35