Home | History | Annotate | Download | only in dcl.ref
      1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -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 #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 
     17 int i;
     18 typedef int& LRI;
     19 typedef int&& RRI;
     20 
     21 typedef LRI& r1; CHECK_EQUAL_TYPES(r1, int&);
     22 typedef const LRI& r2; CHECK_EQUAL_TYPES(r2, int&); // expected-warning {{'const' qualifier on reference type 'LRI' (aka 'int &') has no effect}}
     23 typedef const LRI&& r3; CHECK_EQUAL_TYPES(r3, int&); // expected-warning {{'const' qualifier on reference type 'LRI' (aka 'int &') has no effect}}
     24 
     25 typedef RRI& r4; CHECK_EQUAL_TYPES(r4, int&);
     26 typedef RRI&& r5; CHECK_EQUAL_TYPES(r5, int&&);
     27