1 // { dg-do compile { target c++11 } }
2 template<typename T, typename U> struct same_type;
3 template<typename T> struct same_type<T, T> {};
4 
5 typedef int & lref;
6 typedef int const & clref;
7 typedef int && rref;
8 typedef int const && crref;
9 
10 template<typename T>
11 struct S
12 {
13   typedef T & lref;
14   typedef T const & clref;
15   typedef T && rref;
16   typedef T const && crref;
17 };
18 
19 void 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