[SimplifyCFG] Always allow hoisting if all instructions match. (#97158)
[llvm-project.git] / libcxx / test / std / numerics / complex.number / complex.special / gh_101960_ambiguous_ctor.pass.cpp
blobbffe8764386a75028782c3f991e70c1582aeb55a
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 // <complex>
11 // Regression test for https://github.com/llvm/llvm-project/issues/101960 where we used to
12 // trigger an ambiguous constructor.
14 #include <complex>
15 #include <cassert>
17 struct NastyConvertible {
18 template <class T>
19 operator T() const {
20 return T(0);
24 template <class T>
25 void test() {
26 NastyConvertible nasty;
27 std::complex<T> x(nasty, nasty);
28 assert(x.real() == T(0));
29 assert(x.imag() == T(0));
32 int main(int, char**) {
33 test<float>();
34 test<double>();
35 test<long double>();
37 return 0;