1762bb9d0ad20320b9f97a841dce57ba5e8e48b07Richard Smith// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
20a9a6d68979619a621fedc5089674487f720f765Douglas Gregorstruct X {
30a9a6d68979619a621fedc5089674487f720f765Douglas Gregor  int f() &;
40a9a6d68979619a621fedc5089674487f720f765Douglas Gregor  int g() &&;
50a9a6d68979619a621fedc5089674487f720f765Douglas Gregor  int h() const &&;
60a9a6d68979619a621fedc5089674487f720f765Douglas Gregor};
70a9a6d68979619a621fedc5089674487f720f765Douglas Gregor
80a9a6d68979619a621fedc5089674487f720f765Douglas Gregor// CHECK: define i32 @_ZNR1X1fEv
90a9a6d68979619a621fedc5089674487f720f765Douglas Gregorint X::f() & { return 0; }
100a9a6d68979619a621fedc5089674487f720f765Douglas Gregor// CHECK: define i32 @_ZNO1X1gEv
110a9a6d68979619a621fedc5089674487f720f765Douglas Gregorint X::g() && { return 0; }
120a9a6d68979619a621fedc5089674487f720f765Douglas Gregor// CHECK: define i32 @_ZNKO1X1hEv
130a9a6d68979619a621fedc5089674487f720f765Douglas Gregorint X::h() const && { return 0; }
140a9a6d68979619a621fedc5089674487f720f765Douglas Gregor
154b50263096457552ee86eb790c9638c6bb7357faJohn McCall// CHECK: define void @_Z1fM1XFivREMS_FivOEMS_KFivOE
160a9a6d68979619a621fedc5089674487f720f765Douglas Gregorvoid f(int (X::*)() &, int (X::*)() &&, int (X::*)() const&&) { }
174b50263096457552ee86eb790c9638c6bb7357faJohn McCall
184b50263096457552ee86eb790c9638c6bb7357faJohn McCall// CHECK: define void @_Z1g1AIFivEES_IFivREES_IFivOEES_IKFivEES_IKFivREES_IKFivOEES_IVKFivEES_IVKFivREES_IVKFivOEE()
194b50263096457552ee86eb790c9638c6bb7357faJohn McCalltemplate <class T> struct A {};
204b50263096457552ee86eb790c9638c6bb7357faJohn McCallvoid g(A<int()>, A<int()&>, A<int()&&>,
214b50263096457552ee86eb790c9638c6bb7357faJohn McCall       A<int() const>, A<int() const &>, A<int() const &&>,
224b50263096457552ee86eb790c9638c6bb7357faJohn McCall       A<int() const volatile>, A<int() const volatile &>, A<int() const volatile &&>) {}
23