Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / test / std / experimental / utilities / meta / meta.detect / detected_or.pass.cpp
blob1928b7fcca6c5f55d39ec2b39de095505900a0e1
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 hasFoo = typename T::Foo;
22 struct yesFoo {
23 using Foo = int;
26 struct noFoo {
30 template <typename T, typename Res>
31 void test() {
32 static_assert( std::is_same<Res, typename ex::detected_or <double, hasFoo, T>::type>::value, "" );
33 static_assert( std::is_same<Res, typename ex::detected_or_t<double, hasFoo, T> >::value, "" );
36 int main(int, char**) {
37 test<yesFoo, int>();
38 test<noFoo, double>();
40 return 0;