[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / PCH / cxx2a-constraints.cpp
bloba7fd2a781637261b70a55d8efb9ca74789ca4571
1 // RUN: %clang_cc1 -std=c++2a -emit-pch %s -o %t
2 // RUN: %clang_cc1 -std=c++2a -include-pch %t -verify %s
4 // RUN: %clang_cc1 -std=c++2a -emit-pch -fpch-instantiate-templates %s -o %t
5 // RUN: %clang_cc1 -std=c++2a -include-pch %t -verify %s
7 // expected-no-diagnostics
9 #ifndef HEADER
10 #define HEADER
12 template<typename T, typename U = char>
13 concept SizedLike = sizeof(T) == sizeof(U);
15 template <class T> void f(T) requires (sizeof(int) == sizeof(T)) {}
16 template <class T> void f(T) requires (sizeof(char) == sizeof(T)) {}
18 template <class T> requires (sizeof(int) == sizeof(T)) void g(T) {}
19 template <class T> requires (sizeof(char) == sizeof(T)) void g(T) {}
21 template <SizedLike<int> T> void h(T) {}
22 template <SizedLike<char> T> void h(T) {}
24 template <SizedLike<int> T> void i(T) {}
25 template <SizedLike T> void i(T) {}
27 void j(SizedLike<int> auto ...ints) {}
29 template<template<SizedLike> class P> struct S1 { };
31 #else /*included pch*/
33 int main() {
34 (void)f('1');
35 (void)f(1);
36 (void)g('1');
37 (void)g(1);
38 (void)h('1');
39 (void)h(1);
40 (void)i('1');
41 (void)i(1);
42 (void)j(1, 2, 3);
45 #endif // HEADER