[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / issue547.cpp
blob2a9dd13adf4ecc2b48e2bd4dd0e7f4744692ef0f
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 // expected-no-diagnostics
4 template<typename T>
5 struct classify_function {
6 static const unsigned value = 0;
7 };
9 template<typename R, typename ...Args>
10 struct classify_function<R(Args...)> {
11 static const unsigned value = 1;
14 template<typename R, typename ...Args>
15 struct classify_function<R(Args...) const> {
16 static const unsigned value = 2;
19 template<typename R, typename ...Args>
20 struct classify_function<R(Args...) volatile> {
21 static const unsigned value = 3;
24 template<typename R, typename ...Args>
25 struct classify_function<R(Args...) const volatile> {
26 static const unsigned value = 4;
29 template<typename R, typename ...Args>
30 struct classify_function<R(Args..., ...)> {
31 static const unsigned value = 5;
34 template<typename R, typename ...Args>
35 struct classify_function<R(Args..., ...) const> {
36 static const unsigned value = 6;
39 template<typename R, typename ...Args>
40 struct classify_function<R(Args..., ...) volatile> {
41 static const unsigned value = 7;
44 template<typename R, typename ...Args>
45 struct classify_function<R(Args..., ...) const volatile> {
46 static const unsigned value = 8;
49 template<typename R, typename ...Args>
50 struct classify_function<R(Args..., ...) &&> {
51 static const unsigned value = 9;
54 template<typename R, typename ...Args>
55 struct classify_function<R(Args..., ...) const &> {
56 static const unsigned value = 10;
59 typedef void f0(int) const;
60 typedef void f1(int, float...) const volatile;
61 typedef void f2(int, double, ...) &&;
62 typedef void f3(int, double, ...) const &;
64 int check0[classify_function<f0>::value == 2? 1 : -1];
65 int check1[classify_function<f1>::value == 8? 1 : -1];
66 int check2[classify_function<f2>::value == 9? 1 : -1];
67 int check3[classify_function<f3>::value == 10? 1 : -1];