]> gcc.gnu.org Git - gcc.git/blame - gcc/testsuite/g++.dg/cpp0x/decltype5.C
PR c++/92590 - wrong handling of inherited default ctor.
[gcc.git] / gcc / testsuite / g++.dg / cpp0x / decltype5.C
CommitLineData
4b2e63de 1// { dg-do compile { target c++11 } }
3ad6a8e1
DG
2
3template<typename T, typename U>
4struct is_same
5{
6 static const bool value = false;
7};
8
9template<typename T>
10struct is_same<T, T>
11{
12 static const bool value = true;
13};
14
15#define CHECK_DECLTYPE(DECLTYPE,RESULT) \
16 static_assert(is_same< DECLTYPE , RESULT >::value, #RESULT)
17
18template<typename F> F create_a();
19
20template<typename F, typename T1>
21decltype(create_a<F&>()(create_a<const T1&>())) forward(F f, const T1& a1)
22{
23 return f(a1);
24}
25
26struct identity {
27 template<typename T>
28 const T& operator()(const T& x) { return x; }
29};
30
31
32identity id;
33int i;
34float f;
35
36CHECK_DECLTYPE(decltype(forward(id, i)), const int&);
37CHECK_DECLTYPE(decltype(forward(id, f)), const float&);
This page took 7.585687 seconds and 5 git commands to generate.