1 // { dg-do compile { target c++14 } } 2 // PR 83406, lambda late returns are not the same as missing returns 3 4 class Bar 5 { 6 public: 7 const int& getter() const; 8 int& getter(); 9 }; 10 11 auto one = [](const Bar& bar) -> decltype(auto) 12 { 13 return bar.getter(); 14 }; 15 16 auto two = [](const Bar& bar) -> auto 17 { 18 return bar.getter(); 19 }; 20 21 auto three = [](const Bar& bar) 22 { 23 return bar.getter(); 24 }; 25 26 template <typename T, typename U> struct X 27 { 28 static const bool same = false; 29 }; 30 31 template <typename T> struct X<T,T> 32 { 33 static const bool same = true; 34 }; 35 36 void frob (Bar &x) 37 { 38 static_assert (X<const int &, decltype (one (x))>::same, "not const int &"); 39 static_assert (X<int, decltype (two (x))>::same, "not int"); 40 static_assert (X<int, decltype (three (x))>::same, "not int"); 41 } 42