mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 15:56:06 +00:00

As discussed in https://github.com/llvm/llvm-project/pull/96084#discussion_r1654629993, it would be nice to present these trailing constraints on template parameters when printing CTAD decls through a DeclPrinter.
42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
// RUN: %clang_cc1 -emit-pch -std=c++2a -o %t %s
|
|
// RUN: %clang_cc1 -std=c++2a -x ast -ast-print %t | FileCheck %s
|
|
|
|
// RUN: %clang_cc1 -emit-pch -std=c++2a -fpch-instantiate-templates -o %t %s
|
|
// RUN: %clang_cc1 -std=c++2a -x ast -ast-print %t | FileCheck %s
|
|
|
|
template<typename T>
|
|
concept C = true;
|
|
|
|
template<typename T, typename U>
|
|
concept C2 = true;
|
|
|
|
template<typename T>
|
|
bool f() {
|
|
// CHECK: requires (T t) { t++; { t++ } noexcept -> C; { t++ } -> C2<int>; typename T::a; requires T::val; requires C<typename T::val> || (C<typename T::val> || C<T>); };
|
|
return requires (T t) {
|
|
t++;
|
|
{ t++ } noexcept -> C;
|
|
{ t++ } -> C2<int>;
|
|
typename T::a;
|
|
requires T::val;
|
|
requires C<typename T::val> || (C<typename T::val> || C<T>);
|
|
};
|
|
}
|
|
|
|
namespace trailing_requires_expression {
|
|
|
|
template <typename T> requires C<T> && C2<T, T>
|
|
// CHECK: template <typename T> requires C<T> && C2<T, T> void g();
|
|
void g();
|
|
|
|
template <typename T> requires C<T> || C2<T, T>
|
|
// CHECK: template <typename T> requires C<T> || C2<T, T> constexpr int h = sizeof(T);
|
|
constexpr int h = sizeof(T);
|
|
|
|
template <typename T> requires C<T>
|
|
// CHECK: template <typename T> requires C<T> class i {
|
|
// CHECK-NEXT: };
|
|
class i {};
|
|
|
|
}
|