1// { dg-options "--std=c++0x" }
2template<typename T, typename U> struct same_type;
3template<typename T> struct same_type<T, T> {};
4
5typedef int & lref;
6typedef int const & clref;
7typedef int && rref;
8typedef int const && crref;
9
10template<typename T>
11struct S
12{
13  typedef T & lref;
14  typedef T const & clref;
15  typedef T && rref;
16  typedef T const && crref;
17};
18
19void f()
20{
21  same_type<lref &, int &>();
22  same_type<lref &&, int &>();
23  same_type<rref &, int &>();
24  same_type<rref &&, int &&>();
25
26  same_type<rref const &, int &>();
27  same_type<crref volatile &&, int const &&>();
28  same_type<clref const &&, int const &>();
29
30  same_type<S<int &>::lref &, int &>();
31  same_type<S<int &&>::lref &&, int &>();
32  same_type<S<int &>::rref &, int &>();
33  same_type<S<int &&>::rref &&, int &&>();
34
35  same_type<S<int const &>::rref, int const &>();
36  same_type<S<int volatile &&>::crref, int volatile &&>();
37  same_type<S<int const &&>::clref, int const &>();
38}
39