[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / pr98102.cpp
blob9281279c1848caa8da33ccbbce93f6dca4c5f66c
1 // RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
2 // expected-no-diagnostics
4 template <bool v>
5 struct BC {
6 static constexpr bool value = v;
7 };
9 template <typename T, typename Arg>
10 struct Constructible : BC<__is_constructible(T, Arg)> {};
12 template <typename T>
13 using Requires = T::value;
15 template <typename T>
16 struct optional {
17 template <typename U, Requires<Constructible<T, U>> = true>
18 optional(U) {}
21 struct MO {};
22 struct S : MO {};
23 struct TB {
24 TB(optional<S>) {}
27 class TD : TB, MO {
28 using TB::TB;
31 void foo() {
32 static_assert(Constructible<TD, TD>::value);