[InstCombine] Remove foldSelectICmpEq() fold (#122098)
[llvm-project.git] / libcxx / test / std / utilities / variant / variant.variant / implicit_ctad.pass.cpp
blob8e0432834e19a6cbcc773e70bcf1b943663916cc
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, c++14
11 // <variant>
13 // template <class ...Types> class variant;
15 // Make sure that the implicitly-generated CTAD works.
17 // We make sure that it is not ill-formed, however we still produce a warning for
18 // this one because explicit construction from a variant using CTAD is ambiguous
19 // (in the sense that the programmer intent is not clear).
20 // ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-ctad-maybe-unsupported
22 #include <variant>
24 #include "test_macros.h"
26 int main(int, char**) {
27 // This is the motivating example from P0739R0
29 std::variant<int, double> v1(3);
30 std::variant v2 = v1;
31 ASSERT_SAME_TYPE(decltype(v2), std::variant<int, double>);
35 std::variant<int, double> v1(3);
36 std::variant v2 = std::variant(v1); // Technically valid, but intent is ambiguous!
37 ASSERT_SAME_TYPE(decltype(v2), std::variant<int, double>);
40 return 0;