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