1 | // Copyright (C) 2006 Arkadiy Vertleyb |
2 | // Use, modification and distribution is subject to the Boost Software |
3 | // License, Version 1.0. (http://www.boost.org/LICENSE_1_0.txt) |
4 | |
5 | #include "test.hpp" |
6 | |
7 | BOOST_STATIC_ASSERT(boost::type_of::test<double(*)()>::value); |
8 | BOOST_STATIC_ASSERT(boost::type_of::test<double(*)(int, double, short, char*, bool, char, float, long, unsigned short)>::value); |
9 | BOOST_STATIC_ASSERT(boost::type_of::test<void(*)()>::value); |
10 | BOOST_STATIC_ASSERT(boost::type_of::test<void(*)(int, double, short, char*, bool, char, float, long, unsigned short)>::value); |
11 | BOOST_STATIC_ASSERT(boost::type_of::test<void(*)(...)>::value); |
12 | BOOST_STATIC_ASSERT(boost::type_of::test<void(*)(int, double, short, char*, bool, char, float, long, unsigned short, ...)>::value); |
13 | |
14 | // check that const gets stripped from function pointer |
15 | |
16 | int foo1(double); |
17 | int foo2(...); |
18 | typedef int(*PTR1)(double); |
19 | typedef int(*PTR2)(...); |
20 | typedef const PTR1 CPTR1; |
21 | typedef const PTR2 CPTR2; |
22 | CPTR1 cptr1 = foo1; |
23 | CPTR2 cptr2 = foo2; |
24 | |
25 | BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(cptr1), PTR1>::value)); |
26 | BOOST_STATIC_ASSERT((boost::is_same<BOOST_TYPEOF(cptr2), PTR2>::value)); |
27 | |