Clang Project

clang_source_code/test/SemaCXX/issue547.cpp
1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2// expected-no-diagnostics
3
4template<typename T>
5struct classify_function {
6  static const unsigned value = 0;
7};
8
9template<typename R, typename ...Args>
10struct classify_function<R(Args...)> {
11  static const unsigned value = 1;
12};
13
14template<typename R, typename ...Args>
15struct classify_function<R(Args...) const> {
16  static const unsigned value = 2;
17};
18
19template<typename R, typename ...Args>
20struct classify_function<R(Args...) volatile> {
21  static const unsigned value = 3;
22};
23
24template<typename R, typename ...Args>
25struct classify_function<R(Args...) const volatile> {
26  static const unsigned value = 4;
27};
28
29template<typename R, typename ...Args>
30struct classify_function<R(Args..., ...)> {
31  static const unsigned value = 5;
32};
33
34template<typename R, typename ...Args>
35struct classify_function<R(Args..., ...) const> {
36  static const unsigned value = 6;
37};
38
39template<typename R, typename ...Args>
40struct classify_function<R(Args..., ...) volatile> {
41  static const unsigned value = 7;
42};
43
44template<typename R, typename ...Args>
45struct classify_function<R(Args..., ...) const volatile> {
46  static const unsigned value = 8;
47};
48
49template<typename R, typename ...Args>
50struct classify_function<R(Args..., ...) &&> {
51  static const unsigned value = 9;
52};
53
54template<typename R, typename ...Args>
55struct classify_function<R(Args..., ...) const &> {
56  static const unsigned value = 10;
57};
58
59typedef void f0(int) const;
60typedef void f1(int, float...) const volatile;
61typedef void f2(int, double, ...) &&;
62typedef void f3(int, double, ...) const &;
63
64int check0[classify_function<f0>::value == 2? 1 : -1];
65int check1[classify_function<f1>::value == 8? 1 : -1];
66int check2[classify_function<f2>::value == 9? 1 : -1];
67int check3[classify_function<f3>::value == 10? 1 : -1];
68