blob: ab03a155d3669ac5d4655b58c7b72e16602fd658 [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
Douglas Gregor683a81f2011-01-31 16:09:46 +00002
3template<typename T>
4struct classify_function {
5 static const unsigned value = 0;
6};
7
8template<typename R, typename ...Args>
9struct classify_function<R(Args...)> {
10 static const unsigned value = 1;
11};
12
13template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000014struct classify_function<R(Args...) const> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000015 static const unsigned value = 2;
16};
17
18template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000019struct classify_function<R(Args...) volatile> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000020 static const unsigned value = 3;
21};
22
23template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000024struct classify_function<R(Args...) const volatile> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000025 static const unsigned value = 4;
26};
27
28template<typename R, typename ...Args>
29struct classify_function<R(Args......)> {
30 static const unsigned value = 5;
31};
32
33template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000034struct classify_function<R(Args......) const> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000035 static const unsigned value = 6;
36};
37
38template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000039struct classify_function<R(Args......) volatile> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000040 static const unsigned value = 7;
41};
42
43template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000044struct classify_function<R(Args......) const volatile> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000045 static const unsigned value = 8;
46};
47
48template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000049struct classify_function<R(Args......) &&> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000050 static const unsigned value = 9;
51};
52
53template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000054struct classify_function<R(Args......) const &> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000055 static const unsigned value = 10;
56};
57
58typedef void f0(int) const;
59typedef void f1(int, float...) const volatile;
60typedef void f2(int, double, ...) &&;
61typedef void f3(int, double, ...) const &;
62
63int check0[classify_function<f0>::value == 2? 1 : -1];
64int check1[classify_function<f1>::value == 8? 1 : -1];
65int check2[classify_function<f2>::value == 9? 1 : -1];
66int check3[classify_function<f3>::value == 10? 1 : -1];