p6-0x.cpp revision 8e8fb3be5bd78f0564444eca02b404566a5f3b5d
1// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2// expected-no-diagnostics
3
4template<typename T, typename U>
5struct is_same {
6  static const bool value = false;
7};
8
9template<typename T>
10struct 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
18int i;
19typedef int& LRI;
20typedef int&& RRI;
21
22typedef LRI& r1; CHECK_EQUAL_TYPES(r1, int&);
23typedef const LRI& r2; CHECK_EQUAL_TYPES(r2, int&);
24typedef const LRI&& r3; CHECK_EQUAL_TYPES(r3, int&);
25
26typedef RRI& r4; CHECK_EQUAL_TYPES(r4, int&);
27typedef RRI&& r5; CHECK_EQUAL_TYPES(r5, int&&);
28