Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / experimental / utilities / meta / meta.detect / is_detected.pass.cpp
blob4a977917f1ec6f0e206f1a7469fb80697601cb01
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11
10 // <experimental/type_traits>
12 #include <experimental/type_traits>
13 #include <string>
15 #include "test_macros.h"
17 namespace ex = std::experimental;
19 template <typename T>
20 using copy_assign_t = decltype(std::declval<T&>() = std::declval<T const &>());
22 struct not_assignable {
23 not_assignable & operator=(const not_assignable&) = delete;
26 template <typename T, bool b>
27 void test() {
28 static_assert( b == ex::is_detected <copy_assign_t, T>::value, "" );
29 static_assert( b == ex::is_detected_v<copy_assign_t, T>, "" );
32 int main(int, char**) {
33 test<int, true>();
34 test<std::string, true>();
35 test<not_assignable, false>();
37 return 0;