blob: bfec6e080ba5114dfb83f1740f70cddb17205786 [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
Andy Gibbs8e8fb3b2012-10-19 12:44:48 +00002// expected-no-diagnostics
Douglas Gregor683a81f2011-01-31 16:09:46 +00003
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>
Richard Smithd37b3602012-02-10 11:05:11 +000015struct classify_function<R(Args...) const> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000016 static const unsigned value = 2;
17};
18
19template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000020struct classify_function<R(Args...) volatile> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000021 static const unsigned value = 3;
22};
23
24template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000025struct classify_function<R(Args...) const volatile> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000026 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>
Richard Smithd37b3602012-02-10 11:05:11 +000035struct classify_function<R(Args......) const> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000036 static const unsigned value = 6;
37};
38
39template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000040struct classify_function<R(Args......) volatile> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000041 static const unsigned value = 7;
42};
43
44template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000045struct classify_function<R(Args......) const volatile> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000046 static const unsigned value = 8;
47};
48
49template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000050struct classify_function<R(Args......) &&> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000051 static const unsigned value = 9;
52};
53
54template<typename R, typename ...Args>
Richard Smithd37b3602012-02-10 11:05:11 +000055struct classify_function<R(Args......) const &> {
Douglas Gregor683a81f2011-01-31 16:09:46 +000056 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];