1 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
2 
3 template<typename T, typename U>
4 struct is_same {
5   static const bool value = false;
6 };
7 
8 template<typename T>
9 struct is_same<T, T> {
10   static const bool value = true;
11 };
12 
13 const int&& foo();
14 int i;
15 struct A { double x; };
16 const A* a = new A();
17 
18 static_assert(is_same<decltype(foo()), const int&&>::value, "");
19 static_assert(is_same<decltype(i), int>::value, "");
20 static_assert(is_same<decltype(a->x), double>::value, "");
21 static_assert(is_same<decltype((a->x)), const double&>::value, "");
22 static_assert(is_same<decltype(static_cast<int&&>(i)), int&&>::value, "");
23 
24 int f0(int); // expected-note{{possible target}}
25 float f0(float); // expected-note{{possible target}}
26 
27 decltype(f0) f0_a; // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}}
28