result_of.pass.cpp revision b64f8b07c104c6cc986570ac8ee0ed16a9f23976
1//===----------------------------------------------------------------------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10// <functional>
11
12// result_of<Fn(ArgTypes...)>
13
14#include <type_traits>
15#include <memory>
16
17typedef bool (&PF1)();
18typedef short (*PF2)(long);
19
20struct S
21{
22    operator PF2() const;
23    double operator()(char, int&);
24    void calc(long) const;
25    char data_;
26};
27
28typedef void (S::*PMS)(long) const;
29typedef char S::*PMD;
30
31int main()
32{
33    static_assert((std::is_same<std::result_of<S(int)>::type, short>::value), "Error!");
34    static_assert((std::is_same<std::result_of<S&(unsigned char, int&)>::type, double>::value), "Error!");
35    static_assert((std::is_same<std::result_of<PF1()>::type, bool>::value), "Error!");
36//     static_assert(std::is_same<std::result_of<PMS(std::unique_ptr<S>, int)>::type, void>::value, "Error!");
37//     static_assert(std::is_same<std::result_of<PMD(S)>::type, char&&>::value, "Error!");
38//     static_assert(std::is_same<std::result_of<PMD(const S*)>::type, const char&>::value, "Error!");
39}
40