void f() {
decltype(auto) a = a; if (decltype(auto) b = b) {} decltype(auto) c = ({ decltype(auto) d = c; 0; }); }
void g() {
decltype(auto) a;
decltype(auto) *b;
if (decltype(auto) b) {} for (;decltype(auto) b;) {} while (decltype(auto) b) {} if (decltype(auto) b = true) { (void)b; }
}
decltype(auto) n(1,2,3);
namespace N
{
decltype(auto) a = "const char (&)[19]", b = a, c = (a);
}
void h() {
decltype(auto) b = 42ULL;
for (decltype(auto) c = 0; c < b; ++c) {
}
}
template<typename T, typename U> struct same;
template<typename T> struct same<T, T> {};
void i() {
decltype(auto) x = 5;
decltype(auto) int r; }
namespace p3_example {
template<typename T, typename U> struct is_same_impl {
static const bool value = false;
};
template<typename T> struct is_same_impl<T, T> {
static const bool value = true;
};
template<typename T, typename U> constexpr bool is_same() {
return is_same_impl<T,U>::value;
}
auto x = 5;
const auto *v = &x, u = 6;
static auto y = 0.0;
auto int r;
static_assert(is_same<decltype(x), int>(), "");
static_assert(is_same<decltype(v), const int*>(), "");
static_assert(is_same<decltype(u), const int>(), "");
static_assert(is_same<decltype(y), double>(), "");
#ifdef CXX1Y
auto f() -> int;
auto g() { return 0.0; }
auto h();
static_assert(is_same<decltype(f), int()>(), "");
static_assert(is_same<decltype(g), double()>(), "");
#endif
}