| 1 |
// RUN: %clang_cc1 -std=c++20 -triple=x86_64-windows-msvc -Wno-defaulted-function-deleted -fms-compatibility -fms-extensions -emit-llvm %s -o - | FileCheck %s |
| 2 |
|
| 3 |
namespace CWG2369 { |
| 4 |
|
| 5 |
namespace Regression1 { |
| 6 |
|
| 7 |
template <class, class Up> |
| 8 |
using compare_three_way_result_t = Up::type; |
| 9 |
|
| 10 |
struct sfinae_assign_base {}; |
| 11 |
|
| 12 |
template <class Tp> |
| 13 |
concept is_derived_from_optional = |
| 14 |
requires(Tp param) { []<class Up>(Up) {}(param); }; |
| 15 |
|
| 16 |
template <class Tp, class Up> |
| 17 |
requires(is_derived_from_optional<Up> && []<class W>(W) { return true; }(Up())) |
| 18 |
compare_three_way_result_t<Tp, Up> operator<=>(Tp, Up); |
| 19 |
|
| 20 |
struct RuntimeModeArgs { |
| 21 |
auto operator<=>(const RuntimeModeArgs &) const = default; |
| 22 |
sfinae_assign_base needs_admin; |
| 23 |
}; |
| 24 |
|
| 25 |
RuntimeModeArgs foo() { |
| 26 |
return {}; |
| 27 |
} |
| 28 |
|
| 29 |
// CHECK: ?foo@Regression1@CWG2369@@YA?AURuntimeModeArgs@12@XZ |
| 30 |
|
| 31 |
} // namespace Regression1 |
| 32 |
|
| 33 |
namespace Regression2 { |
| 34 |
|
| 35 |
template <class _Tp> |
| 36 |
constexpr _Tp * __to_address(_Tp *) { |
| 37 |
return nullptr; |
| 38 |
} |
| 39 |
|
| 40 |
template <class _Ip> |
| 41 |
concept contiguous_iterator = requires(_Ip __i) { __to_address(__i); }; |
| 42 |
|
| 43 |
struct basic_string_view { |
| 44 |
template <contiguous_iterator _It> |
| 45 |
basic_string_view(_It, _It); |
| 46 |
}; |
| 47 |
|
| 48 |
const char *str; |
| 49 |
void sv() { basic_string_view(str, str); } |
| 50 |
|
| 51 |
void m_fn2() { |
| 52 |
const char __trans_tmp_1 = *__to_address(&__trans_tmp_1); |
| 53 |
} |
| 54 |
|
| 55 |
// CHECK: define {{.*}} @"??$__to_address@$$CBD@Regression2@CWG2369@@YAPEBDPEBD@Z" |
| 56 |
|
| 57 |
} // namespace Regression2 |
| 58 |
|
| 59 |
} |
| 60 |
|
| 61 |
namespace GH147650 { |
| 62 |
|
| 63 |
template <int> int b; |
| 64 |
template <int b> |
| 65 |
void f() |
| 66 |
requires requires { [] { (void)b; }; } {} |
| 67 |
void test() { |
| 68 |
f<42>(); |
| 69 |
} |
| 70 |
// CHECK-LABEL:define {{.*}} void @"??$f@$0CK@@GH147650@@YAXXZ"() |
| 71 |
} |