1 // PR c++/53223
2 // { dg-do compile { target c++11 } }
3 
4 #include <type_traits>
5 
6 #define SA(x) static_assert ((x), #x)
7 
8 struct A
9 {
10   int good() const;
11   int operator *() const;
12   int operator ++() const;
13   int operator [](int) const;
14 };
15 
16 int operator-- (const A&);
17 
18 template<typename T>
func(T t)19 void func(T t)
20 {
21   A x;
22   auto &&g1 = x.good();
23   auto &&g2 = x.operator*();
24   auto &&error1 = *x;
25   auto &&error2 = ++x;
26   auto &&error3 = --x;
27   auto &&error4 = x[5];
28   SA ((std::is_same<int &&, decltype (error1)>::value));
29   SA ((std::is_same<int &&, decltype (error2)>::value));
30   SA ((std::is_same<int &&, decltype (error3)>::value));
31   SA ((std::is_same<int &&, decltype (error4)>::value));
32 }
33 
func2(int)34 void func2(int)
35 {
36   A x;
37   auto &&g = *x;
38 }
39 
main()40 int main()
41 {
42   func(0);
43   func2(0);
44 }
45 
46