1 // { dg-do compile { target c++11 } }
3 template<typename T, typename U>
6 static const bool value = false;
12 static const bool value = true;
15 #define CHECK_DECLTYPE(DECLTYPE,RESULT) \
16 static_assert(is_same< DECLTYPE , RESULT >::value, #RESULT)
25 CHECK_DECLTYPE(decltype(a), int);
26 CHECK_DECLTYPE(decltype(b), int&);
27 CHECK_DECLTYPE(decltype(c), const int&);
28 CHECK_DECLTYPE(decltype(d), const int);
29 CHECK_DECLTYPE(decltype(e), const A);
31 CHECK_DECLTYPE(decltype(a), int);
32 CHECK_DECLTYPE(decltype((a)), int&);
34 void foo_check(int a, int& b, float& c, int* d)
36 CHECK_DECLTYPE(decltype(a), int);
37 CHECK_DECLTYPE(decltype(b), int&);
38 CHECK_DECLTYPE(decltype(c), float&);
39 CHECK_DECLTYPE(decltype(d), int*);
45 CHECK_DECLTYPE(decltype(foo), int(char));
47 decltype(bar) z; // { dg-error "overload" "overload" }
49 CHECK_DECLTYPE(decltype(&foo), int(*)(char));
50 CHECK_DECLTYPE(decltype(*&foo), int(&)(char));
55 CHECK_DECLTYPE(decltype(a), int[10]);