1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 // expected-no-diagnostics
3 
4 template<typename T, typename U>
5 struct is_same {
6   static const bool value = false;
7 };
8 
9 template<typename T>
10 struct is_same<T, T> {
11   static const bool value = true;
12 };
13 #define JOIN2(X,Y) X##Y
14 #define JOIN(X,Y) JOIN2(X,Y)
15 #define CHECK_EQUAL_TYPES(T1, T2) \
16   int JOIN(array,__LINE__)[is_same<T1, T2>::value? 1 : -1]
17 
18 int i;
19 typedef int& LRI;
20 typedef int&& RRI;
21 
22 typedef LRI& r1; CHECK_EQUAL_TYPES(r1, int&);
23 typedef const LRI& r2; CHECK_EQUAL_TYPES(r2, int&);
24 typedef const LRI&& r3; CHECK_EQUAL_TYPES(r3, int&);
25 
26 typedef RRI& r4; CHECK_EQUAL_TYPES(r4, int&);
27 typedef RRI&& r5; CHECK_EQUAL_TYPES(r5, int&&);
28